I am retrieving date values from a db, which are NULL. I set these to a BOL property:-
Code:
rs("startdate") = premium.startdate
My startdate object is:-
Code:
Private _startdate as Nullable(Of Date)
Public startdate as Nullable(Of Date)
Get
return _startdate
End Get
Set(ByVal value as Nullable(Of Date))
_startdate = value
End Set
End Property
so, I presume this should be DBNull if the database value is NULL.
But, when I try and do a comparison against the property:-
Code:
If Not txt_startdate.Text = premium.startdate Then
I gat an error:-
Nullable object must have a value
Should I set the initial value of the startdate object to something? It won't let me set it to DBNull.value. What should I do to deal with these NULL values?
Thanks