I am trying to execute the following code:
QString qryTxt = "INSERT INTO payments_" + getCurrentYear() + " (" + current_month + ") VALUES (" + QString::number(1) + ") WHERE ref_no = " + refNosList[i];
query.prepare(qryTxt);
if (!query.exec())
{
qDebug() << "Error" << query.lastError().text();
return false;
}
in the debugging mode this what I see as my qryTxt:
"INSERT INTO payments_2015 (January) VALUES (1) WHERE ref_no = 3"
But it is still returning the following error:
Error "No query Unable to fetch row"
P.S.: without the part saying WHERE ref_no = 3, the query works fine.
extra
- The ref_no (3) exists in the db
- table and column names are correct
Aucun commentaire:
Enregistrer un commentaire