Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
> operator vs. datarow column of System.Decimal type?
Message
De
02/12/2003 14:41:14
 
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Divers
Thread ID:
00855035
Message ID:
00855152
Vues:
14
>>FWIW, casting to (int) gives me a runtime error -- "Specified cast is not valid"-- even though the object is not null.<

Kelly,

From your original post, you said the data column was decimal, so I assume you want to cast it to decimal, not int. I bet that will work just fine.

~~Bonnie




>
>If I try to cast (int)dsQuery["mycol"].ToString() (not your suggestion, just something I tried), I get a compile error about not being able to cast from string to int -- which is why I think I ended up doing the Int32.Parse(Column.ToString()) earlier.
>
>>The other way is to cast the object to an int
>>
>>(int)dsQuery["SalesMin"] > 0
>>
>>
>>You will run into problems if you are trying to cast a null object though.
>>
>>Morgan
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform