ADO访问access做数据库搜索却总是报错,请指教 20
数据库初始化和连接没有问题但是总是报:UnhandledexceptioninADO.exe(KERNEL.DLL):OxE06D7363:MicrosoftC++Exc...
数据库初始化和连接没有问题 但是总是报:Unhandled exception in ADO.exe(KERNEL.DLL):OxE06D7363:Microsoft C++ Exception错误
void CADODlg::OnReadaccess()
{
// TODO: Add your control notification handler code here
_variant_t var;
CString strName,strAge;
// 清空列表框・
m_AccessList.ResetContent();
strName=strAge="";
try
{
if(!m_pRecordset->BOF)
m_pRecordset->MoveFirst();
else
{
AfxMessageBox("表内数据为空");
return;
}
// 读字段到列表框
while(!m_pRecordset->adoEOF)
{
var = m_pRecordset->GetCollect("Name");
if(var.vt != VT_NULL)
strName = (LPCSTR)_bstr_t(var);
var = m_pRecordset->GetCollect("Age");
if(var.vt != VT_NULL)
strAge = (LPCSTR)_bstr_t(var);
m_AccessList.AddString( strName + " --> "+strAge );
m_pRecordset->MoveNext();
}
m_AccessList.SetCurSel(0);
}
catch(_com_error *e)
{
AfxMessageBox(e->ErrorMessage());
}
} 展开
void CADODlg::OnReadaccess()
{
// TODO: Add your control notification handler code here
_variant_t var;
CString strName,strAge;
// 清空列表框・
m_AccessList.ResetContent();
strName=strAge="";
try
{
if(!m_pRecordset->BOF)
m_pRecordset->MoveFirst();
else
{
AfxMessageBox("表内数据为空");
return;
}
// 读字段到列表框
while(!m_pRecordset->adoEOF)
{
var = m_pRecordset->GetCollect("Name");
if(var.vt != VT_NULL)
strName = (LPCSTR)_bstr_t(var);
var = m_pRecordset->GetCollect("Age");
if(var.vt != VT_NULL)
strAge = (LPCSTR)_bstr_t(var);
m_AccessList.AddString( strName + " --> "+strAge );
m_pRecordset->MoveNext();
}
m_AccessList.SetCurSel(0);
}
catch(_com_error *e)
{
AfxMessageBox(e->ErrorMessage());
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询