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. Not getting response from database
Qt 6.11 is out! See what's new in the release blog

Not getting response from database

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 400 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.
  • M Offline
    M Offline
    Mikeeeeee
    wrote on last edited by
    #1

    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?

    VRoninV 1 Reply Last reply
    0
    • M Mikeeeeee

      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?

      VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

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

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      1 Reply Last reply
      3

      • Login

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