Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DateTimePicker and null

Status
Not open for further replies.

codemech

Programmer
Feb 8, 2004
34
0
0
US
I have a SQL field, "PurchaseDate DateTime Null", where the date is optional.

Is it possible to set a DateTimePicker on a Windows form to a null value?

I am starting to think that if you need null date values on your Windows form then the DateTimePicker control is not the correct control to use.

Thanks,
Codemech
 
DateTimes don't handle DBNull at all. Usually what I do is when I see a null, I change the date value to DateTime.MinValue, and the reverse when writing the date back to the database (if mydate == DateTime.MinValue, write a null).

Chip H.


____________________________________________________________________
Click here to learn Ways to help with Tsunami Relief
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top