|
-
Aug 31st, 2005, 02:30 AM
#1
Thread Starter
Lively Member
[RESOLVED] null dates - actually required
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:
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:
x = dbnull
if mydate.equals(x) then ...
which also doesn't work..
ARGH....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|