UpdateData(true);
CUserRecordset m_user;
try
{
if(m_user.IsOpen());
m_user.Close();
m_user.m_strFilter.Format("用户名='%s'and 密码='%s'",m_username,m_userpwd);
m_user.Open(CRecordset::snapshot,NULL,CRecordset::none);
if(m_user.IsEOF())
{m_user.Close();
AfxMessageBox("密码错误,请重试!");
return;
}
else
{m_user.Close();
AfxMessageBox("登陆成功!");
}
}
catch(CException* e)
{
e->ReportError();
return;
}
CDialog::OnOK();
调试结果:
kDlg.cpp
E:\练习调试\12\k\kDlg.cpp(186) : error C2065: 'CUserRecordset' : undeclared identifier
E:\练习调试\12\k\kDlg.cpp(186) : error C2146: syntax error : missing ';' before identifier 'm_user'
E:\练习调试\12\k\kDlg.cpp(186) : error C2065: 'm_user' : undeclared identifier
E:\练习调试\12\k\kDlg.cpp(189) : error C2228: left of '.IsOpen' must have class/struct/union type
E:\练习调试\12\k\kDlg.cpp(190) : warning C4390: ';' : empty controlled statement found; is this the intent?
E:\练习调试\12\k\kDlg.cpp(190) : error C2228: left of '.Close' must have class/struct/union type
E:\练习调试\12\k\kDlg.cpp(191) : error C2228: left of '.m_strFilter' must have class/struct/union type
E:\练习调试\12\k\kDlg.cpp(191) : error C2228: left of '.Format' must have class/struct/union type
E:\练习调试\12\k\kDlg.cpp(192) : error C2228: left of '.Open' must have class/struct/union type
E:\练习调试\12\k\kDlg.cpp(193) : error C2228: left of '.IsEOF' must have class/struct/union type
E:\练习调试\12\k\kDlg.cpp(194) : error C2228: left of '.Close' must have class/struct/union type
E:\练习调试\12\k\kDlg.cpp(199) : error C2228: left of '.Close' must have class/struct/union type
Generating Code...
PS:在StdAfx.h中已经加了#include