hi there, the function exec() in the code below returns false all the time and I've tried everything to fix it but without any success. Could I be missing something here. please help.
{
QString qryStr
= QString("INSERT INTO Modules VALUES(\"%1, %2 %3 %4\")").
arg(qry.
at(0)).
arg(qry.
at(1)).
arg(qry.
at(2)).
arg(qry.
at(3));
query.prepare(qryStr);
if(query.exec())
else
}
void MainWindow::query(QStringList qry)
{
QString qryStr = QString("INSERT INTO Modules VALUES(\"%1, %2 %3 %4\")").arg(qry.at(0)).arg(qry.at(1)).arg(qry.at(2)).arg(qry.at(3));
QSqlQuery query;
query.prepare(qryStr);
if(query.exec())
QMessageBox::critical(0, "DB Status","DATABASE UPDATED", QMessageBox::Ok);
else
QMessageBox::critical(0, "DB Status","DATABASE NOT UPDATED", QMessageBox::Ok);
}
To copy to clipboard, switch view to plain text mode
Bookmarks