QT QSqlQuery bind values isn't working -


i have been trying bind values line edits saved qstrings implement simple login application. here's have far:

void login::on_pushbutton_clicked(){      qstring username,password;     username = ui->lineedit_username->text();     password = ui->lineedit_2_password->text();       qsqlquery qry;     qry.prepare("select * staff s_login=:user , s_password=:pass");     qry.bindvalue(":user", username);     qry.bindvalue(":pass", password);     qmap<qstring,qvariant> q = qry.boundvalues();     if (qry.exec()){         int count = 0;         while(qry.next()){             count++;         }         if (count == 1){             ui->label_4->settext("username , password correct");             connclose();         }         if (count > 1){             ui->label_4->settext("duplicate username , password");         }         if (count > 1){             ui->label_4->settext("username , password incorrect");         }     }     else{         qdebug()<<"its not working...";         qdebug()<<qry.executedquery();         qdebug()<<qry.qsqlquery::lasterror();     } } 

qdebug output:

connected not working... "select * staff s_login=? , s_password=?" qsqlerror("", "parameter count mismatch", "") 

the qmap in code verify qry binding values, have verified debugging i'm still getting question marks in executed query...

any appreciated thank you!


Comments