QString c_user,c_password;
c_user=CLoginUi->m_user->text().trimmed();
c_password=CLoginUi->m_password->text().trimmed();
if(c_user!=NULL&&c_password!=NULL)
{
QSqlQuery query;
query.prepare("select * from tb_operator where name='"+c_user+"'and password='"+c_password+"'");
query.exec();
if(query.next())
{accept();}
else
{
QMessageBox::warning(this,tr("Warning"),tr("The User Or Password error!"),QMessageBox::Yes);
CLoginUi->m_password->clear();
}
}
转载于:https://www.cnblogs.com/cqhstyle/p/4777518.html