Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Rounding issue during Select()
Message
From
03/03/2011 08:44:47
Jerry Tovar
Dana Corporation Dana It
Maumee, Ohio, United States
 
 
To
All
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
Rounding issue during Select()
Environment versions
Environment:
C# 3.0
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01502491
Message ID:
01502491
Views:
80
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
Map
View

Click here to load this message in the networking platform