Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Read float type field error by QODBC(SQL Server 2017) after upgrade windows patch "November 8, 2022-KB5020686 or KB5020695"
Forum Updated to NodeBB v4.3 + New Features

Read float type field error by QODBC(SQL Server 2017) after upgrade windows patch "November 8, 2022-KB5020686 or KB5020695"

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 388 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Tony Guo
    wrote on last edited by Tony Guo
    #1

    After I upgraded window patch (win10 November 8, 2022-KB5020686, win11 KB5020695), if table has float type field, QODBC will raise an error and the column result is QVariant(Invalid).

    Below example, query.value(1) will got an QVariant(Invalid) value. But it returned a QVariant(Double) value if I run it on win7(Because win7 does not has such upgrade package).

    
    #include <QCoreApplication>
    #include <QSqlDatabase>
    #include <QSqlQuery>
    #include <QDebug>
    #include <QSqlError>
    
    int main(int argc, char *argv[])
    {
        QCoreApplication a(argc, argv);
        QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
    
        QString dsn = QString("DRIVER=%1;SERVER=%2;PORT=%3;DATABASE=%4;UID=%5;PWD=%6")
                .arg("{SQL Server}")
                .arg("127.0.0.1")
                .arg(1433)
                .arg("TestDB")
                .arg("sa")
                .arg("sa");
    
        db.setHostName("127.0.0.1");
        db.setDatabaseName(dsn);
        db.setUserName("sa");
        db.setPassword("sa");
    
        if(!db.open()) {
            qDebug()<<db.lastError().text();
        } else {
            qDebug()<<"database open success!";
            QSqlQuery query(db);
            query.exec("select id, my_float from my_table");
            while(query.next()) {
                qDebug()<<query.value(0) << query.value(1);
            }
            return -1;
        }
    }
    
    
    
    
    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      See https://bugreports.qt.io/browse/QTBUG-108307 and blame MS :)
      Downgrade to an older ODBC driver (or use the recent 17.x one)

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      Christian EhrlicherC 1 Reply Last reply
      1
      • Christian EhrlicherC Christian Ehrlicher

        See https://bugreports.qt.io/browse/QTBUG-108307 and blame MS :)
        Downgrade to an older ODBC driver (or use the recent 17.x one)

        Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Even the topic is old I think the problem was fixed with KB5022282 on January, 10th 2023.

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        1 Reply Last reply
        1

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved