hi.

i have a database that stores a date and a time (seperatly for various reasons) in a pair of date time fields.

it is possible, indeed probable that these fields may be null (either or both) which is not a problem, representing "I don't know" answers.

within the database this is not a problem

moving to vb.net however the dates & times map to the 'system.datetime' data type very well with one problem. It can't handle nulls.

'system.datetime' *always* returns a valid date, thus when i load it with a null value it returns its default. problem is i need a way of assigning a null date, so when i update the database i can leave null values alone, or assign a null value.

so far the only way i can see to do this is to create my own datetime class with an 'isValid' flag i can set & use, or to use 'magic' values for null which i'd rarther avoid since it will screw up a whole range of reports the database runs.

i've tried setting
VB Code:
  1. myDate = nothing
&
VB Code:
  1. if myDate.equals(nothing) then ...
to no avail.

there must be a way of doing this, and its got to be simple but i can't quiet see it.

i've also tried
VB Code:
  1. x = dbnull
  2. if mydate.equals(x) then ...
which also doesn't work..

ARGH....