Sql problem - parameter mismatch count
Hi everyone,
i'm trying to execute sql command, but everytime i get an error "Parameter count mismatch".
Looking other examples i think that sql syntax is ok. Maybe i'm wrong, that's why i'm asking your help :)
Please, can someone tell what is wrong with code?
This is the code:
Code:
QString strQ
= "INSERT INTO item(dict_id, word, prefix, translated, audioPath, example, pronunciation, wordtype, synonyms) VALUES(?,?,?,?,NULL,?,?,?,?)";
qDebug() <<"PREPARE: " << query.prepare(strQ);
query.
bindValue(3,
QVariant(translated
));
if(query.exec(strQ))
{
qDebug() << "Query exec YES";
MyMessageBox mb;
mb.setStyleSheet("background-color:white; color:black;");
mb.setText("A new word is added: " + word);
mb.
setIconPixmap(QPixmap(":111.png"));
mb.setAutoClose(true);
mb.setTimeOut(2);
mb.exec();
}
else
{
qDebug()<<query.lastError().text() << query.boundValues().count();
}
And this is output:
PREPARE: true
" Parameter count mismatch" 0
Thx a lot for any suggestion ;):)
Re: Sql problem - parameter mismatch count
I don't know.May be there are 9 fields but you are binding 8 values.