Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Inserting NULL values to Datetime field
Message
From
01/12/2003 12:29:40
 
General information
Forum:
ASP.NET
Category:
ADO.NET
Miscellaneous
Thread ID:
00854693
Message ID:
00854732
Views:
16
>I am using a typed dataset and SqlDataAdapter to update data. How do I insert NULL value in the DataTime field? I tried DBNull.value and a few other things but none works.<

Unfortunately, at least with SQL Server, sending a NULL to the back-end just doesn't work ... with any data type, not just datetime.

The workaround that we use it just not to send NULLs to the backend ... we use Stored Procs for all our DataAccess ... the parameters in the SP default to NULL, so since we don't set a parameter for those columns in the DataSet that contain DBNull.value, the parameter will default to NULL in the SP and consequently a NULL value will be entered into the table that way. I don't know if that helps you much, but you're going to have to look for alternative ways to handle this anyway.

~~Bonnie
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Reply
Map
View

Click here to load this message in the networking platform