各位大大指点下啊代码调试的时候没错,一运行跳出OK对话框之后就出现This application has requested the Runtime to,该如何解决

各位大大指点下啊,代码调试的时候没错,一运行跳出OK对话框之后就出现This application has requested the Runtime to
void CDlgLogin::OnOK() 
{
// TODO: Add extra validation here

UpdateData(TRUE);
  CString sql;
static int count;
  if(m_name.IsEmpty()||m_password.IsEmpty())
{
MessageBox("用户名、不能为空!");
return;
}
 
  sql.Format("select * from USER where user_name='%s' AND user_password='%d'",
  m_name,m_password);

  m_pRecordset.CreateInstance("ADODB.Recordset");
m_pRecordset->Open(LPCTSTR(sql),_variant_t((IDispatch *)m_pConnection,true),
adOpenStatic,adLockOptimistic,adCmdText); // 创建记录集

if(m_pRecordset->adoEOF)
{
if(count<3)
{
MessageBox("用户名或密码错误!");
m_name=" ";
  m_password=" ";
UpdateData(FALSE);
count++;
}
else
{
MessageBox("输入错误达三次以上,本窗口将关闭");
EndDialog(IDCANCEL);
}
}
else 
{
 
MessageBox("欢迎进入操作界面!");
switch(m_radio)
{
case 0:
  EndDialog(IDOK);  
Sdlg.DoModal();
break;
case 1:  
EndDialog(IDOK);  
Tdlg.DoModal();
break;
case 2:  
EndDialog(IDOK);  
Mdlg.DoModal();
break;  
}
}
  if(m_pConnection->State)
  m_pConnection->Close();
m_pConnection = NULL;
  //CDialog::OnOK();
}

------解决方案--------------------
你没说清楚
可能是需要安装vc runtime库吧,或没有设置好ODBC的源
------解决方案--------------------
C/C++ code
This function destroys a modal dialog box, causing the system to end any processing for the dialog box. 

BOOL EndDialog( 
  HWND hDlg, 
  int nResult
);

------解决方案--------------------
可能是产生了野指针的问题。