求助,发生abnormal program termination错误
不知为什么我输入用户名密码后,按确定按钮就发生错误,显示
DEBUG Error!
abnormal program termination
我用的是access连接数据库,按钮的代码如下,求解
void CDlg_login::OnOK()
{
// TODO: Add extra validation here
this->UpdateData(true);
::CoInitialize(NULL);
this->m_pConnection.CreateInstance(__uuidof(Connection));
this->m_pRecordset.CreateInstance(__uuidof(Recordset));
this->m_pConnection->Open("DSN=arp_db_dsn","","",0);//上面四行为打开数据源连接
CString str;
str.Format("select * from user where userName='%s' and password='%s'",this->m_login_name,this->m_login_pwd);
BSTR bstrSQL=str.AllocSysString();
this->m_pRecordset->Open(bstrSQL,(IDispatch*)this->m_pConnection,adOpenDynamic,adLockOptimistic,adCmdText);
if(!this->m_pRecordset->adoEOF)
CDialog::OnOK();
else
MessageBox("登陆有误");
this->m_pRecordset->Close();
this->m_pConnection->Close();
}