J
Jose Fernandez
Hello.
how can i cast a null value from a datareader (System.DBNull) to dateTime
I have an object. One of its fields is a DateTime type field. From the
database i am getting System.DBNull values from its corresponding column.
What can I do to cast it? i don't want to implement a custom method for
this.
myClass.ExpirationDate=Convert.ToDateTime(dr["ExpirationDate"]); // throw an
exception.
Object cannot be cast from DBNULL to other types.
how can i cast a null value from a datareader (System.DBNull) to dateTime
I have an object. One of its fields is a DateTime type field. From the
database i am getting System.DBNull values from its corresponding column.
What can I do to cast it? i don't want to implement a custom method for
this.
myClass.ExpirationDate=Convert.ToDateTime(dr["ExpirationDate"]); // throw an
exception.
Object cannot be cast from DBNULL to other types.