Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Rounding issue during Select()
Message
De
03/03/2011 08:44:47
Jerry Tovar
Dana Corporation Dana It
Maumee, Ohio, États-Unis
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
Rounding issue during Select()
Versions des environnements
Environment:
C# 3.0
OS:
Windows XP SP2
Divers
Thread ID:
01502491
Message ID:
01502491
Vues:
81
I have a C# routine that loops through a DataTable and tries to find a matching record in another DataTable. This works fine except in the case where the table being searched has as a field with more than 2 decimal places.

In the below example, the payment field typically has 2 decimal places. However, in a few records the decimal places are more than 2 which causes a record not to be found when it should be found.

How can I search the Payment field but only use 2 decimal places?

//
//Payment = "50.2600005" Amount = "50.26"
//
drMyResults = dtSearchTable.Select("Payment = '" + drLookupTable["Amount"].ToString() + "' ");

Thanks,

Jerry
Répondre
Fil
Voir

Click here to load this message in the networking platform