Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cannot assign a Blank/Null date
Message
From
18/04/2007 15:41:24
Keith Payne
Technical Marketing Solutions
Florida, United States
 
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
01216819
Message ID:
01217462
Views:
10
>>I have a DateTime field in a table and sometimes I want to store a blank /null data there (The field is set up in Sql Server to accept nulls)
>>I have the following code
>>string lcNull = null;
>>if (DOC_DATERE.SelectedValue.ToString().Trim() == "")
>> {
>> DOC_DATERE.SelectedValue = lcNull;
>> }
>>... but this throws a run time error of:-
>> Object Reference not set to an instance of an object.
>>If I space out the field I get this error, if there is a valid date there its ok.
>>
>>Anybody know how to get a null date into the field ?
>>
>>Regards,
>>Gerard
>
>Check out Re: Int? definiton. What is it? Thread #1192933 Message #1192937
>
>It might just be for C# and it was introduced in 2.0 and I am not even sure if DateTime is supported by nullable types but it might be worth looking into.

Guys,

Yes, DateTime is supported by the nullable structure.
DateTime? dt = null;
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform