DateTime to null

  • Thread starter Thread starter Alan T
  • Start date Start date
Hello Alan,

You can't really. You can assign DbNull, but DateTime is a valuetype, therefore
no null...


Thanks,
Shawn Wildermuth
Speaker, Author and C# MVP
http://adoguy.com
 
"Shawn Wildermuth (C# MVP)" <[email protected]> a écrit dans le
message de news: (e-mail address removed)...

| > How do I set a DateTime field to null ?
| > Hence set the DateTimePicker to null?
|
| You can't really. You can assign DbNull, but DateTime is a valuetype,
therefore
| no null...

But, if you are using C# 2.0, you can use Nullable<DateTime> which can be
set to null and you can detect that, setting the database to DbNull where
appropriate.

Joanna
 
Hi,

Will the DateTimePicker accept nullable types?
AFAIK it does expect a DateTime.
 
Back
Top