B Brock Allen May 5, 2005 #2 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
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
S Steve C. Orr [MVP, MCSD] May 5, 2005 #3 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
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