Information générale
Catégorie:
Code, syntaxe and commandes
Titre:
Rounding issue during Select()
Versions des environnements
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
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement