This really should have been more obvious to me, so why did I have to look it up? If you need to check for NULL in a returned field from SQL (or any other datasource), you should the .Equals method on System.DBNull.Value. I usually prefer the "==" notation for conditionals, but that's just me. This is more efficient. The code follows:
if (!dsSpecQuery.Tables[0].Rows[0]["device_type_end"].Equals(System.DBNull.Value)) { _EndDate = Convert.ToDateTime(dsSpecQuery.Tables[0].Rows[0]["device_type_end"]); }
Of course, dsSpecQuery is a DataSet, and the field in question is DateTime out of SQLServer (not that it matters for the conditional).
Remember Me
b, blockquote@cite, i, strike, strong, u
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.