How do I null a date?

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

Guest

C#

I have a data entry screen where one of the options is to enter a start and
end datetime. Mostly there will not be an end time. But I cant display no
date in the datetime field on the screen, and I cant send a null date to my
stored procedure. How do I do this?

Thanks

Ste
 
A date is a value type and therefore can't be set to null. You pass
DbValue.Null.

Check the msdn for a closer description.

Greetings,
Eduard Ralph
 
when I want a date to be null, i just set its value to: 1/1/1901 which
I beleive is the DateTime.MinValue like Eduard mentioned.
 
Is the end date field in the database table non-nullable? If it is
nullable, you can simply make the parameter optional in the stored
procedure.

Regards,
Jim
 
Back
Top