[Qt-interest] Qt 4.5.2 handles numeric(10.6) as String
Sylvain Pointeau
sylvain.pointeau at gmail.com
Mon Nov 2 05:36:52 CET 2009
hello,
I found the solution...
I use QSqlRecord
then QSqlField then type() to know if this is a double
I think that value() return a QVariant that is a QString for precision
issue.
Best regards,
Sylvain
On Sat, Oct 31, 2009 at 8:37 AM, Sylvain Pointeau <
sylvain.pointeau at gmail.com> wrote:
> Hi all,
>
> I connect to a SQL server 2005 database by the line:
>
> QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
> db.setDatabaseName("DRIVER={SQL
> Server};server=XXXX;uid=XX;pwd=YYYYY;database=ZZZZZZ;");
>
> when I retrieve some rows, especially the numeric(15,6) are seen as string
> on the Qt side:
>
> QVariant v = query.value(i);
> v.type() always 10 (QVariant::String)
>
> How can I know about the real type of this field?
> I would like to see them as "double", am I wrong?
>
> Many thanks in advance for your help,
>
> Best regards,
> Sylvain
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091102/e1e28a2d/attachment.html
More information about the Qt-interest-old
mailing list