Object cannot be cast from DBNull to other types - using SQL 2000/C#
Posted on 2007-03-27
Wonder if you can help me, I keep getting the following error:
Object cannot be cast from DBNull to other types.
I have the following code:
dateSend_ADHOC = myDataReader["DT_SEND"].ToString();
if (dateSend_ADHOC == "") // I guess I get the error here?
dateSend_ADHOC could have a date or left blank i.e. in SQL left as null
How do I get this to work?