DateTime Null Question

  • Thread starter Thread starter Guest
  • Start date Start date
You can't, as it's a value type. Same as an int. If you're looking for database
null semantics then you need to use an alternate data type that supports
the notion of null, like System.Data.SqlTypes.SqlDateTime.

-Brock
DevelopMentor
http://staff.develop.com/ballen
 
The Date variable type cannot be null. It must have a value.
Most people use Date.MinValue (or Date.MaxValue) to represent a null date in
their code.

Example:
Dim MyDate as Date = Date.MinValue

As for inserting it in the database, the other guys already specified that
DBNull.Value is what you'll want to use.

The better news is that in .NET 2.0 all variable types will be nullable.
Here's more info:
http://www.panopticoncentral.net/archive/2004/06/04/1180.aspx
 
Back
Top