I am creating a simple SQLite update in my Qt5/C++ program using QSqlQuery. When I execute the query below I get the error "Parameter count mismatch". But why?
QSqlQuery updateQuery;
updateQuery.prepare("UPDATE mytable SET m=:m WHERE r=:r AND u=:u LIMIT 1");
updateQuery.bindValue(":m", m);
updateQuery.bindValue(":r", r);
updateQuery.bindValue(":u", u);
sqlErrors = !updateQuery.exec();
Variables m, r, u are QString's. I have 3 parameters, and bind all three. Where's the mismatch? SO posts like this only refer to INSERT commands, but everything else applicable seems right.
Checking lastQuery() confirms the bind substitutions are not happening. I can also see that the prepare statement is failing (returning false) - yet it looks like valid SQL to me.