我是C ++的新手,在Qt中运行查询时出现问题,这是我的代码。
QString username,password;
username = ui->lineEditUsername->text();
password = ui->lineEditPassword->text();
QSqlQuery qry;
if(qry.exec("SELECT * FROM admin WHERE username ='"+username+"' AND password ='"+password+"'")){
ui->label->setText("Query Worked");
}else{
ui->label->setText("Query Failed");
}
这个Out put Query Failed
,为什么?请帮帮忙?