为什么我用下面的代码会出错:
_variant_t strSQL;
strSQL="select * from 密码表 where USER1='"+dlg.m_strUser+"' and PASWD1='"+dlg.m_strPass+"'";
pTheSet->Open(strSQL,pTheConn.GetInterfacePtr(),adOpenDynamic,adLockOptimistic, adCmdText);
if(pTheSet->GetRecordCount()==0)
{
MessageBox("用户名或密码错误");
pTheSet->Close();
return;
}为什么明明用户名和密码是错的,可它还是不执行if 里面的程序呢
_variant_t strSQL;
strSQL="select * from 密码表 where USER1='"+dlg.m_strUser+"' and PASWD1='"+dlg.m_strPass+"'";
pTheSet->Open(strSQL,pTheConn.GetInterfacePtr(),adOpenDynamic,adLockOptimistic, adCmdText);
if(pTheSet->GetRecordCount()==0)
{
MessageBox("用户名或密码错误");
pTheSet->Close();
return;
}为什么明明用户名和密码是错的,可它还是不执行if 里面的程序呢
pTheSet->Open(strSQL,pTheConn.GetInterfacePtr(),adOpenDynamic,adLockOptimistic, adCmdText);
if(pTheSet->adoEOF)
{
MessageBox("用户名或密码错误");
if(pTheSet->GetState())
pTheSet->Close();
return;
}
catch(_com_error &e)
{
AfxMessageBox(e.ErrorMessage());
}
{
MessageBox("用户名或密码错误");AfxMessageBox(e.ErrorMessage());
}