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

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



  • 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", "")


  • Lifetime Qt Champion

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


  • Moderators

    @Casino said:

    5"
    "VALUES

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


Log in to reply