Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Inserting NULL values to Datetime field
Message
De
01/12/2003 12:29:40
 
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Divers
Thread ID:
00854693
Message ID:
00854732
Vues:
15
>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform