Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Best Practices for a null field
Message
De
25/01/2006 10:10:54
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, États-Unis
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
Best Practices for a null field
Versions des environnements
Environment:
VB.NET 1.1
Database:
MS SQL Server
Divers
Thread ID:
01090093
Message ID:
01090093
Vues:
65
Hello,

I have a table where a field can be null. At a certain point in code, I am pulling the value from that table and assigning it to a string. I get an error stating "Cast from type 'DBNull' to type 'String' is not valid", which is expected.

How should I handle this? I know in the SQL call I can use the ISNULL and substitute a space, which is how I handled this before. Should I test the value before I try to assign it everytime? Should I not be storing NULL values?

Thanks for the advice,
MAC
Very fitting: http://xkcd.com/386/
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform