Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Cannot assign a Blank/Null date
Message
De
17/04/2007 12:36:58
John Baird
Coatesville, Pennsylvanie, États-Unis
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
01216819
Message ID:
01216834
Vues:
13
Use DBNull.Value for datatables/SQL tables.



>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform