ADO 连接Access编译通过,运行出错
出错如下:
Runtime Error!
This application has requested the Runtime to terminate it in unusual way.
Please contact the application's support team for more information.
我的代码:
void CADOTest5Dlg::OnButton1()
{
// TODO: Add your control notification handler code here
CoInitialize(NULL);
_ConnectionPtr pConn(__uuidof(Connection));
_RecordsetPtr pRst(__uuidof(Recordset));
pConn->ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=G:\MyProject\Access\Test1.mdb"
pConn->Open("","","",-1);
pRst=pConn->Execute("select * from Table1",NULL,adCmdText);
while(!pRst->adoEOF)
{
((CListBox*)GetDlgItem(IDC_LIST1))->AddString(
(_bstr_t)pRst->GetCollect("NAME"));
pRst->MoveNext();
}
pRst->Close();
pConn->Close();
pRst.Release();
pConn.Release();
CoUninitialize();
}
我的import语句:
#import "C:\Program Files\Common Files\System\ADO\msado15.dll" \
no_namespace rename("EOF", "adoEOF")
怎么回事?如何解决?谢谢