Hi guys (and gals) ...
I have a very tricky problem around number conversion, decimal accuracy and calculations that has me scratching my head for a few days now.
In the db I have values in columns of the datatype decimal(18,2). I want to have an accuracy of 2 decimal places throughout my application and in the db it works fine.
When I am resolving the data coming from the database in a dataset, things go wrong:
float payedTotal = float.Parse(r["col_name"].ToString());
If I check the value of r["col_name"], it is 555.65, with two decimal places as expected. The float value however has the value 555.656, and rounds up to 555.70 when I display it in my application.
Am I missing something here ... or should I do the conversion and datatypes in some other way ?