J
John Sutter
The DateTime type is giving me some grief with null values.
I am using SQLHelper from the data blocks. I have a textbox which accepts a
date. The field is optional. This text field gets converted to a parameter
of type DateTime in a function call.
I am trying to assign System.DateTime.MinValue to that datetime variable if
the user didn't enter a date. However System.DateTime.MinValue gets a value
of "1/1/1" which SQL Server doesn't accept because it's smaller than
1/1/1753.
How can I assign a NULL value to a DateTime which sql server accepts as
real null value as in DBNull.Value. Somehow I am missing a way to convert a
null DateTime to a sql server aware DBNull.Value.
John
I am using SQLHelper from the data blocks. I have a textbox which accepts a
date. The field is optional. This text field gets converted to a parameter
of type DateTime in a function call.
I am trying to assign System.DateTime.MinValue to that datetime variable if
the user didn't enter a date. However System.DateTime.MinValue gets a value
of "1/1/1" which SQL Server doesn't accept because it's smaller than
1/1/1753.
How can I assign a NULL value to a DateTime which sql server accepts as
real null value as in DBNull.Value. Somehow I am missing a way to convert a
null DateTime to a sql server aware DBNull.Value.
John