General information
Category:
Coding, syntax and commands
Title:
Rounding issue during Select()
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
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only