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. ME RESULTA IMPOSIBLE ACTUALIZAR LA BASEDEDATOS SQLITE, LA CREO, INSERTO NUEVOS REGISTROS, LOS MUESTRO, PERO EL UPDATE NO ARRANCA, AHI VA MI CODIGO A VER SI CONSIGO UNA MANO
Forum Updated to NodeBB v4.3 + New Features

ME RESULTA IMPOSIBLE ACTUALIZAR LA BASEDEDATOS SQLITE, LA CREO, INSERTO NUEVOS REGISTROS, LOS MUESTRO, PERO EL UPDATE NO ARRANCA, AHI VA MI CODIGO A VER SI CONSIGO UNA MANO

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 259 Views 1 Watching
  • 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.
  • C Offline
    C Offline
    Casino
    wrote on last edited by
    #1

    void Blind_Dialog::on_modificar_clicked()
    {

    QSqlQuery actualizar;
    if(db.open()){
    
    actualizar.prepare("UPDATE blinds SET sblind, bblind, ante, time, break WHERE Id = 5"
                       "VALUES (:sblind, :bblind, :ante, :time, :break)");
    
    actualizar.bindValue(":sblind",ui->Sblind->text());
    actualizar.bindValue(":bblind",ui->Bblind->text());
    actualizar.bindValue(":ante",ui->Ante->text());
    actualizar.bindValue(":time",ui->Time->text());
    actualizar.bindValue(":break",ui->Break->text());
    actualizar.exec();
    if(!actualizar.exec())
            {
                qDebug() << "Can't Execute Query !";
            }
            else
            {
                qDebug() << "Query Executed Successfully !";
            }
    
    if(actualizar.exec()){
       qDebug()<<"El registro se ha modificado";
    }else{
       qDebug()<<"El registro NO se ha modificado";
       qDebug()<<"ERROR!"<<actualizar.lastError();
    }
    }else
        qDebug()<<"La base de datos no esta abierta";
    

    }
    //Mensaje del programa ERROR! QSqlError("", "Parameter count mismatch", "")

    jsulmJ 1 Reply Last reply
    0
    • C Casino

      void Blind_Dialog::on_modificar_clicked()
      {

      QSqlQuery actualizar;
      if(db.open()){
      
      actualizar.prepare("UPDATE blinds SET sblind, bblind, ante, time, break WHERE Id = 5"
                         "VALUES (:sblind, :bblind, :ante, :time, :break)");
      
      actualizar.bindValue(":sblind",ui->Sblind->text());
      actualizar.bindValue(":bblind",ui->Bblind->text());
      actualizar.bindValue(":ante",ui->Ante->text());
      actualizar.bindValue(":time",ui->Time->text());
      actualizar.bindValue(":break",ui->Break->text());
      actualizar.exec();
      if(!actualizar.exec())
              {
                  qDebug() << "Can't Execute Query !";
              }
              else
              {
                  qDebug() << "Query Executed Successfully !";
              }
      
      if(actualizar.exec()){
         qDebug()<<"El registro se ha modificado";
      }else{
         qDebug()<<"El registro NO se ha modificado";
         qDebug()<<"ERROR!"<<actualizar.lastError();
      }
      }else
          qDebug()<<"La base de datos no esta abierta";
      

      }
      //Mensaje del programa ERROR! QSqlError("", "Parameter count mismatch", "")

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Casino Please post here https://forum.qt.io/category/31/spanish if you want to write Spanish

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      3
      • sierdzioS Offline
        sierdzioS Offline
        sierdzio
        Moderators
        wrote on last edited by
        #3

        @Casino said:

        5"
        "VALUES

        You have no space after 5 so the SQL syntax is wrong. Unfortunately SQLite error messages are extremely confusing.

        (Z(:^

        1 Reply Last reply
        4

        • Login

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