Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
> operator vs. datarow column of System.Decimal type?
Message
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Titre:
> operator vs. datarow column of System.Decimal type?
Divers
Thread ID:
00855035
Message ID:
00855035
Vues:
77
Newbie ADO.NET / C# question here. I have a datarow with a column of System.Decimal (Number(0) in Oracle) type and I want to find out whether that column's value is > 0.

When I try the code below, I'm told "Operator '>' cannot be applied to operands of type 'object' and 'int'." I see in the .NET help that the System.Decimal type has a GreaterThan method. That should work fine for me, but Intellisense is not popping that up as a choice for the column. I know that it is a System.Decimal datatype though because I wrote the result of calling GetType() out to the web page I'm working on.

Here's the method I'm working on and the error occurs on the "if" statement line.
public string GetQueryDescription( DataRow drQuery )
{
  StringBuilder QueryDesc = new StringBuilder();

  QueryDesc.Append( drQuery["QueryName"] + " - " );

  if (drQuery["SalesMin"] > 0 )
     QueryDesc.Append( "Sales " + drQuery["SalesMin"].ToString() + "MM+" );
			
  //TODO: String together other meaningful items for the description here...
	
  return QueryDesc.ToString();
}
I even tried casting my column to (System.Decimal) just in case and am then told that "'object' does not contain a definition for 'GreaterThan'."

Based on those 2 different error messages, it would appear that drQuery["SalesMin"] is being seen as "just" an Object vs. a System.Decimal, even though .GetType does return System.Decimal.

Any ideas? Thanks.

Kelly
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform