Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-108307

QODBC: MSSQL ODBC Driver 18.1.2 does not return float/double values

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • P1: Critical
    • None
    • 5.15.2
    • SQL Support
    • None
    • MSSQL ODBC Driver 18.1.2
    • Windows

    Description

      when accessing data via SQL Server ODBC Driver 18.1.2, QODBC database query can't read value from FLOAT type field. example:

      #include <QtSql/QSqlDatabase>
      #include <QtSql/QSqlQuery>
      #include <QtCore/QVariant>
      int main(int argc, char *argv[])
      {
          auto db = QSqlDatabase::addDatabase("QODBC");
          db.setDatabaseName("Driver={SQL Server};Server=192.168.1.2;Uid=sa;Pwd=123;Database=master");
          db.open();
          QSqlQuery qry("SELECT CAST(1234.56 AS FLOAT)", db);
          qry.next();
          auto val = qry.value(0).toFloat();
          printf_s("= %f\n", val);
          // = 0.000000 on Windows 11 with KB5019961
          // = 1234.560059 on Windows 11 without KB5019961
          db.close();
      }

       

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              chehrlic Christian Ehrlicher
              jirauser65731 user-3fe4c (Inactive)
              Votes:
              3 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes