Exception Number in VS2005

  • Thread starter Thread starter Rick
  • Start date Start date
R

Rick

How to I get the Exception Number (code) for a database related error?
I get the following error and I need to catch it to display a custom message.

System.InvalidCastException: Unable to cast object of type 'System.DBNull'
to type 'System.Byte
 
How to I get the Exception Number (code) for a database related error?
I get the following error and I need to catch it to display a custom message.

System.InvalidCastException: Unable to cast object of type 'System.DBNull'
to type 'System.Byte

Hi,

There is no such a thing, You can know the problem by the Exception
Type and the Message.
In your case it;s clearly a casting issue

Tip:
try to use coalesce in the sql query
 
Back
Top