Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Handling Null Value In DataSet
Message
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01432130
Message ID:
01432136
Vues:
45
>I'm doing this:
>
>
>_RoleKey = (int)dsDataSet.Tables[0].Rows[0]["RoleKey"];
>
>
>It's throwing an exception because RoleKey is null in the data. How do I handle this?

You can branch the logic into two paths by checking for DBNull.Value first.

Also you may want to define your _RoleKey as int?
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform