Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Object cannot be cast from DBNull to other type
Message
De
24/05/2013 15:33:55
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01574643
Message ID:
01574650
Vues:
51
That's how I've dealt with it, even though it doesn't make sense. How can DBNull have a value when null, by definition, has no value?


>>>Convert.ToDateTime((row["start_time"]== DBNull.Value)?DTSqlMinDate:row["start_time"]);
>>
>>I think you were confusing DBNull with C# null which is what the ?? operator uses.......
>
>I thought the above would prevent the problem. Is there any other way to fix it besides my solution?
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform