56,687
社区成员
发帖
与我相关
我的任务
分享
_ConnectionPtr m_pConn;
_RecordsetPtr pRst = NULL;
CoInitialize(NULL);
try
{
hr = m_pConn.CreateInstance(__uuidof(Connection));
TESTHR(hr);
hr = m_pConn->Open("Provider=MSDASQL.1;Persist Security Info=False;User ID=root;Data Source=MCS01;Initial Catalog=iris", "", "", adConnectUnspecified);
TESTHR(hr);
TESTHR(pRst.CreateInstance(__uuidof(Recordset)));
HRESULT hr = pRst->Open("CALL findfile('c:\', 0)", _variant_t((IDispatch*) m_pConn, true), adOpenKeyset, adLockOptimistic, adCmdText);
TESTHR(hr);
}
catch (_com_error& ce)
{
//...
}
TESTHR(pRst->Close());
pRst.Release();
pRst = NULL;
m_pConn->Close();
m_pConn.Release();
m_pConn.Detach();