Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Assign DBNull.Value to datatime data column
Message
 
À
24/07/2008 00:12:29
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
C# 2.0
OS:
Windows XP SP2
Database:
MySQL
Divers
Thread ID:
01333634
Message ID:
01333871
Vues:
10
I don't use MySQL but I assume that it is similar to SQL Server on this issue. Date fields don't really have a null value so you have to assign them a minimum value, such as DateTime.MinValue.

>Hi,
>
>I have error message :Object cannot be cast from DBNull to other types. when i try to assign null value to poDate data field. My database is mySql.
>
>
>
>
>  protected void DetailsView1_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
>  {
>        if (e.NewValues["poDate"] == null)
>           e.NewValues["poDate"] = DBNull.Value ;
>
>
>
>
>How to solve this problem?
>
>TIA.
Linda Harmes
HiBit Technologies, Inc.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform