QString var_s_user,var_s_pass,var_s_sql;
var_s_user=ui->lineEdit_user->text().trimmed();
var_s_pass=ui->lineEdit_pass->text().trimmed();
var_s_sql="select username from user where username = " +var_s_user + " and password="+var_s_pass+";";
query_cmd.exec(var_s_sql);
QString var_s_user,var_s_pass,var_s_sql;
var_s_user=ui->lineEdit_user->text().trimmed();
var_s_pass=ui->lineEdit_pass->text().trimmed();
QSqlQuery query_cmd;
var_s_sql="select username from user where username = " +var_s_user + " and password="+var_s_pass+";";
query_cmd.exec(var_s_sql);
To copy to clipboard, switch view to plain text mode
I have finished the connection to the database .And it could connect to the data normally.
But I just cant solve the login part.So how to check if the username and password is right.
I use the code QSqlRecord rec = query_cmd.record();to find out if there is a right username and password in the database.But it did not work .So anyone could give me some examples?
Bookmarks