|
-
Sep 8th, 2005, 10:35 AM
#1
Thread Starter
Hyperactive Member
DateTime datatype
How to insert a null value in a column of datatype 'DateTime'? I am coding in c#.
Thanks,
-
Sep 8th, 2005, 12:02 PM
#2
Fanatic Member
Re: DateTime datatype
i dont think you can
is column required????
d2005 - pure novice
-
Sep 8th, 2005, 12:09 PM
#3
Re: DateTime datatype
The DateTime object is essentially a struct, thus it's stored on the stack (where as classes are stored on the heap). Therefore, it cannot be null.
However, this has been provided for - there are static properties that one may use: "MinValue" and "MaxValue". If you initialise the instance to (for example) DateTime.MinValue, you can perform a check against that.
Code:
DateTime myDate = DateTime.MinValue;
if (myDate == DateTime.MinValue) {
// Your code that would be executed if the instance is not initialised.
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|