Actually, you can’t assign a null value to a Date Type variable but you can check if the variable has been set or not by comparing its current value versus default value (#12:00:00 AM#) of date/datetime, you can get the default value by using
-
Date.MinValue or DateTime.MinValue
To do this, let say you have a variable called LastUpdate with a data type of Datetime
-
Dim LastUpdate as DateTime
-
dim dr as Datarow
-
-
If DateTime.MinValue = LastUpdate Then
-
'Its Null value
-
'if you want to save the value to the database then use the DBNull.Value
-
dr("LastUpdate") = DBNull.Value
-
Else
-
dr("LastUpdate") =LastUpdate
-
End If