Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Assign DBNull.Value to datatime data column
Message
 
To
24/07/2008 00:12:29
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
C# 2.0
OS:
Windows XP SP2
Database:
MySQL
Miscellaneous
Thread ID:
01333634
Message ID:
01333871
Views:
9
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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform