Hi
Can anyone help me in finiding the solution for the DBHull value type casting.
Infact I am storing values into the database and retrieving them into the datagrid. when there is null value in the database it gives me an error " System.InvalidCastException: Object cannot be cast from DBNull to other types.
at System.DBNull.System.IConvertible.ToDateTime(IFormatProvider provider) at
System.Convert.ToDateTime(Object value)".
Any idea how to manage it while I would like to mention that while adding the parameters into the database I am using ("Parameter", DBNull.Value).
Many Thanks.
DBNull Value type casting
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Suthish NairRank #92 · 22.8K pointsPosted Feb 1, 2011, 9:08 AM EST
Sam HobbsRank #108 · 20.5K pointsPosted Feb 1, 2011, 11:50 AM EST
Suthish NairRank #92 · 22.8K pointsPosted Feb 4, 2011, 9:20 AM EST