M
Mike Loux
Has anyone else run into this problem? I am pulling date values from
an AS/400 DDS file via OleDb using an SQL statement. Sometimes (and
there does not seem to be any rhyme or reason to this), when I do a
Date.TryParse on a date field that is empty, I get the current date
instead of Date.MinValue. Time is 12 AM, like it should be. Kind of
throws off your validation when you're expecting 01/01/0001 and you
get 10/27/2008 instead.
I have tried just doing away with the TryParse and dealing with the
field as-is (after all, it is a date field, should always get a date
value, right?), but that sometimes leads to Object Reference Not Set
errors and the like. Very strange. For now I am just checking the
value in the field, and if it's blank, I use Date.MinValue by
default.
Oh yes, this is .Net Framework 2.0. That probably would help. Thanks!
an AS/400 DDS file via OleDb using an SQL statement. Sometimes (and
there does not seem to be any rhyme or reason to this), when I do a
Date.TryParse on a date field that is empty, I get the current date
instead of Date.MinValue. Time is 12 AM, like it should be. Kind of
throws off your validation when you're expecting 01/01/0001 and you
get 10/27/2008 instead.
I have tried just doing away with the TryParse and dealing with the
field as-is (after all, it is a date field, should always get a date
value, right?), but that sometimes leads to Object Reference Not Set
errors and the like. Very strange. For now I am just checking the
value in the field, and if it's blank, I use Date.MinValue by
default.
Oh yes, this is .Net Framework 2.0. That probably would help. Thanks!