[Qt-interest] SQL (ODBC) retreiving doubles incorrectly

Andre Somers andre at familiesomers.nl
Fri Oct 2 12:07:55 CEST 2009


Hi,

I am running into a very weird issue right now.
I am using the SQL module to connect to an access database through ODBC. 
That has served me reasonably well untill now. I am trying to retreive 
values from a query that returns some floating point values. The data 
type for the field is correctly identified as as QVariant::double. 
However, when trying to read values, I get into trouble for values 
smaller than 0,1. In this case, the QVariant returned seems to contain 
only the scientific notation part of the value, like E-2 or E-3. Those 
values alone can obviously not be converted properly into a double, the 
the .toDouble() call on the QVariant returned from the query returns 0 
and sets the boolean value passed to check the success to false.

I really need to be able to read any value, even if they are in the 
range of 1E-10. If I open the query in Access, I can see all the values 
just fine, and none of them appears in scientic notation.

Any clues how to solve this issue?

André



More information about the Qt-interest-old mailing list