Master Mind

Master Mind

  • NA
  • 1
  • 5.3k

DBNull Value type casting

Feb 1 2011 9:48 AM
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.


Answers (3)