提示Unhandled exception in *.exe:0xc0000005 Access Voilation
程序是这样的
void jsk::OnSelchangeCombo1() //点击组合框的一栏弹出对话框
{ int index;
index=((CComboBox *)GetDlgItem(IDC_COMBO1))->GetCurSel();
((CComboBox *)GetDlgItem(IDC_COMBO1))->GetLBText(index,m_str);
GetName(m_str); ////////////////////////////这句出错,提示Unhandled exception in *.exe:0xc0000005 Access Voilation
qq.DoModal();
UpdateData(FALSE);
}
void jsk::GetName(CString lpHost)
{ _RecordsetPtr ptr;
CMy11App * p=(CMy11App *)AfxGetApp();
if(lpHost == NULL)
return ;
else
{p->strSql = "select * from TABLE4 where 主人='"+lpHost+"'";
p->open(ptr);
int i=0;
while(!ptr->rsEOF)
{
n[i]=(LPCTSTR)(_bstr_t)ptr->GetCollect("姓名");
GetName(n[i]);
qq.m[i]=n[i];
i++;
ptr->MoveNext();
}
}
}
看网上说好像是因为无效句柄,常常是由于指针问题引起的,但俺不会改了,不懂