Insert Null Date

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do I insert a null date into sql 2000? I tried this:

DateTime expireDate = (txtExpDate.Text.Trim().Length <= 0) ?
DateTime.MinValue : DateTime.Parse(txtExpDate.Text);

and

DateTime expireDate = (txtExpDate.Text.Trim().Length <= 0) ? null :
DateTime.Parse(txtExpDate.Text);

it doesn't accept nulls for DateTime, and the MinValue is not null.
Can anyone help please?
 
I guess that's not possible...what you have to do is if the date text box
field is null than set the date as '1/1/1900' and compare the date in Sql
Server if the value is same enter null value, otherwise the actual value.

Raj
 
Back
Top