My SQL Server database contains nullable DateTime values. How can I convert them to a nullable DateTime object in my application in C#?
This is what I would think it
You need to check if the value "is DBNull" rather than just null. I posted a small helper class on my blog: http://improve.dk/archive/2007/10/08/handling-dbnulls.aspx
Once you implement the class, you use it like this:
DateTime? dt = DBConvert.To<datetime?>(sqldatareader[0]);