Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Strongly Typed Dataset Question
Message
De
17/04/2007 13:17:02
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, États-Unis
 
 
À
17/04/2007 12:56:28
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Versions des environnements
Environment:
VB.NET 1.1
Divers
Thread ID:
01215567
Message ID:
01216869
Vues:
13
I never thought about trying it that way. Thanks Bonnie! I will give it a try.

>Mike,
>
>If you want to continue using the IIF statement (which C# doesn't have, BTW), then you can do it like this:
>
>
>IIF(dr.IsFieldNameNull,"",dr("FieldName"))
>
>
>~~Bonnie
>
>
>
>
>>So far this is my only complaint with Strongly Typed Datasets, and I hope it is just because of lack of knowledge.
>>
>>My datarow contains a decimal type field which is Null. I need to convert it to a string. When I try dr.FieldName.ToString I get a runtime error because it is DBNull. When I try dr.Item("FieldName").ToString, it works and I end up with an empty string.
>>
>>When I try IIF(dr.IsFieldNameNull,"",dr.FieldName), I get an runtime error because I am assuming it is evaluating both results.
>>
>>Before I have done a full IF statement, but that is going to really suck doing that for every field that could be Null. What is the recommended way of handling this?
>>
>>Thanks!
Very fitting: http://xkcd.com/386/
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform