Friday, March 9, 2012

Decimal values get truncated when using SqlDataReader in C# .net

The values that are being fetched from the database are not being read as is , when there are decimal values with 10 or more digits after the point, the values are truncated (approximated) to 8 digits

The approximation is not consistent in all the cases
Some times depending on the numbers for example 0.434000001 is truncated to 0.434.

This is happening when i read the values from the sql database using the SqlDataReader.GetValue method into an ArrayList in C# .NETLooks like you r datatype is (the flaky) float.

What is it?

Did you try defining it as decimal?

No comments:

Post a Comment