Date Time Picker & Null Values

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 -
 
V

VJ

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top