Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Not getting response from database



  • Hi.
    My program is connected to the Firebird database.
    This query works in the Firebird database.

    SELECT GEN_ID(GEN_UESRS_ID , 1) FROM RDB$DATABASE
    

    But if I do so in Qt, the debug returns: query.value(0): 0

        query.prepare("SELECT GEN_ID(GEN_UESRS_ID , 1) FROM RDB$DATABASE");
    
        if(!query.exec())
        {
            emit sig_error(query.lastError().text());
            qDebug()<<"не записалось";
            qDebug()<<"query.lastError().text() : "<<query.lastError().text();
            msg = "false";
        }
        else {
            qDebug()<<"Ok";
            qDebug()<<"query.value(0):"<<query.value(0).toInt();
            msg = "true";
        }
    

    Why am I not getting an answer and how do I fix it?



  • change else { to else if(query.next()){


Log in to reply