Date Time Picker & Null Values

  • Thread starter Thread starter John Smith
  • Start date Start date
J

John Smith

Hello all:

I am having some difficulty trying to bind some Date Time Picker
controls to a database that may have Null values in some of these
fields. I continue to get the following error:

"Object cannot be cast from DBNull to other types."

I have tried to manually set the values to a valid date but to no avail.

What is the best way to bind these date values to their corresonding
controls given that some may have null values in them?

Thanks,

- John -
 
its unfourtunate that DateTime does not handle null properly... One way
could be that you set a date like 01/01/1900 and map that to like a empty
string and then display empty string when you hit 01/01/1900

But others might have a better idea here..

VJ
 
Back
Top