Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Datetime to Null?
Message
 
À
21/01/2004 11:28:58
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
00869059
Message ID:
00869304
Vues:
14
As you know, the .net DataTime value type has no concept of an empty or null date. Basically, you need to have a convention in your application that some value, usually 1/1/1900 or 1/1/1, will represent an empty date. I think Rick Strahl had some sample code here on the foums a couple of weeks back that showed how to databind to an emtpy date. When you are persisting the value you check for the empty date "value" and write back a System.DBNull to the table.

Ultimately, I believe that the best way to introduce the concept of nullability to value types in .net will be something along the lines of the NullableTypes project (http://nullabletypes.sourceforge.net/).


>In a winform app, I’m using a textbox class derived from mmTextBox bound to a datetime column in MSSQL. How do I make it save a NULL back to the database when the date is removed by the user? Even when the date is set to blank it reverts to the original date.
>
>
>Terry Carroll
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform