468,512 Members | 1,448 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,512 developers. It's quick & easy.

How to set date type to null

ddt
Hi
I have a object which has a date type property, but if I not assign any value to it, it always display "#12:00:00 AM#" or "1/1/0001". How can I leave it as empty or null/dbnull value

Thanks in advance
ddt
Nov 20 '05 #1
5 7144
Hi, ddt

as DateTime is value type, you can't use null with it. However, you can
always check if it is equal to DateTime.MinValue and act accordingly. It's
not that much difference with checking for null, right?

HTH
Alex

"ddt" <an*******@discussions.microsoft.com> wrote in message
news:A9**********************************@microsof t.com...
Hi,
I have a object which has a date type property, but if I not assign any value to it, it always display "#12:00:00 AM#" or "1/1/0001". How can I
leave it as empty or null/dbnull value?
Thanks in advance.
ddt

Nov 20 '05 #2
"ddt" <an*******@discussions.microsoft.com> schrieb
Hi,
I have a object which has a date type property, but if I not assign
any value to it, it always display "#12:00:00 AM#" or "1/1/0001". How
can I leave it as empty or null/dbnull value?


This is not possible. A value type can not be Null or Nothing.

http://groups.google.com/groups?selm...ews.freenet.de

--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #3
* =?Utf-8?B?ZGR0?= <an*******@discussions.microsoft.com> scripsit:
I have a object which has a date type property, but if I not assign
any value to it, it always display "#12:00:00 AM#" or "1/1/0001". How
can I leave it as empty or null/dbnull value?


See (complete thread):

<URL:http://www.google.de/groups?threadm=%23wkAjb1mDHA.2080%40TK2MSFTNGP10.p hx.gbl>

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #4
ddt
Thanks a lot.
Nov 20 '05 #5
Yes was a nice thread

:-)

Cor
Nov 20 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Dominique Javet | last post: by
6 posts views Thread by evolve | last post: by
6 posts views Thread by Dean Slindee | last post: by
9 posts views Thread by ice | last post: by
4 posts views Thread by anagai | last post: by
4 posts views Thread by Allen Browne | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by fmendoza | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.