F
francois
Hi,
I have some fields in my database that are of the float DB type (I am using
SQL Server 2000)
When I get the values from the DB in my C# code i do something like
SqlDataReader reader;
....
double dValue = (double) reader["price"];
let say the value of the price field is O.92 in the DB. And to make sure of
it I just run and SQL update in the DB, using Sql Query analyzer to ensure
that the values i well 0.92.
When I run the code, if I have the following test :
bool b = (dValue == 0.92);
SOMETIMES b will be true and sometimes it will be false.
If I debug I see that sometimes dValue is 0.92 and sometimes something like
0.920000000000004
Moreover if I run the query analyzer and run the select statement in it, I
also have the same problem getting the weird 0.920000000000004 value
displayed.
Then I assume the problem is on the SQL server side. But I assume that as it
is such basic functionality there must exist a solution for it isn't it? Can
anyone help me on this it would be VERY appreciated.
Best regards too all readers.
Francois.
I have some fields in my database that are of the float DB type (I am using
SQL Server 2000)
When I get the values from the DB in my C# code i do something like
SqlDataReader reader;
....
double dValue = (double) reader["price"];
let say the value of the price field is O.92 in the DB. And to make sure of
it I just run and SQL update in the DB, using Sql Query analyzer to ensure
that the values i well 0.92.
When I run the code, if I have the following test :
bool b = (dValue == 0.92);
SOMETIMES b will be true and sometimes it will be false.
If I debug I see that sometimes dValue is 0.92 and sometimes something like
0.920000000000004
Moreover if I run the query analyzer and run the select statement in it, I
also have the same problem getting the weird 0.920000000000004 value
displayed.
Then I assume the problem is on the SQL server side. But I assume that as it
is such basic functionality there must exist a solution for it isn't it? Can
anyone help me on this it would be VERY appreciated.
Best regards too all readers.
Francois.