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 15:35:28
 
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Divers
Thread ID:
00855035
Message ID:
00855172
Vues:
16
This message has been marked as the solution to the initial question of the thread.
Kelly,

I just wonder why you bothered with the CompareTo method? Couldn't you just have used this:
if ((decimal)drQuery["SalesMin"] > 0)
~~Bonnie

>Good thought, thanks. I actually had tried that earlier with similar failure as trying to cast to int. However, based on your suggestion, I did find something that works. The reason that it didn't work for me before (the commented line below) was that "inline" casting apparently doesn't allow access to the methods of the casted type (I'm just guessing here, but Intellisense wouldn't pop up the list of Decimal members and at runtime I was told that CompareTo was not a member of the object).
>
>
>//if ((decimal)drQuery["SalesMin"].CompareTo( (decimal)0 ) > 0)
>decimal SalesMin = (decimal)drQuery["SalesMin"];
>if (SalesMin.CompareTo( (decimal)0 ) > 0)
>
>
>Thanks to everyone for the suggestions.
>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
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