thanks for your help,but I want to use this method without importing ado.dll: CString m_strConnect.Format("Provider=OraOLEDB.Oracle.1;Password=user_password;Persist Security Info=True;User ID=user_id;Data Source=user_DATASource;"); _RecordsetPtr m_prs; _ConnectionPtr m_pConnection; HRESULT hr = S_OK; try { hr = m_prs.CreateInstance(__uuidof(Recordset)); if(FAILED(hr)) { AfxMessageBox("记录集对象建立失败!",MB_ICONINFORMATION); return ; } BeginWaitCursor(); m_strSQL = "select * from tableA"; hr = m_prs->Open(_bstr_t(m_strSQL),(IDispatch*)m_pConnection,adOpenStatic ,adLockReadOnly,adCmdText); if(FAILED(hr)) { AfxMessageBox("数据库查询失败!",MB_ICONINFORMATION); return ; } EndWaitCursor(); } catch(_com_error e) { CString errormessage; errormessage.Format("错误信息:%s",(char*)(e.Description())); AfxMessageBox(errormessage, MB_ICONINFORMATION); return; } catch (CException err) { err.ReportError(); return; } catch(...) { AfxMessageBox("未知错误!",MB_ICONINFORMATION); return; } compiles show errors:_ConnectionPtr not definition