WHERE clause causing error in qsqlquery. Query works without WHERE clause

36 Views Asked by At

I am working on a project in which I take data from the input fields and update the data in the data base based on the serial no. Here is my code:

QSqlQuery sqry;
if(sqry.prepare("UPDATE second_weight "
                "SET s_weight_type=:s_weight_type, s_weight=:s_weight, s_driver_included=:s_driver_included,s_amount=:s_amount,"
                "s_paid_status=:s_paid_status, sdate=:sdate, stime=:stime"
                "WHERE first_weight_FK = :s_sID")){
    sqry.bindValue(":s_weight_type",weightstrSec);
    sqry.bindValue(":s_weight",weightSec);
    sqry.bindValue(":s_driver_included",dIncStrSec);
    sqry.bindValue(":s_amount",amntSec);
    sqry.bindValue(":s_paid_status", statusSec);
    sqry.bindValue(":s_sdate",datevalSec);
    sqry.bindValue(":s_stime",timevalSec);
    sqry.bindValue(":s_sID",srStrSec);
    sqry.exec();

I have tried running this query without WHERE clause and it works that way. But when I use WHERE clause following error is generated.

QODBCResult::exec: Unable to execute statement: "[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'Pa_RaM006 first_weight_FK = Pa_RaM007'."

I am working with MS ACCESS database file. Can Anyone help me with this? Thank you.

0

There are 0 best solutions below