ADO的连接????????????????
HRESULT hr;
_bstr_t strconn;
_ConnectionPtr pCn=NULL;
hr=::CoInitialize(NULL);
AssertValid();
if (FAILED(hr))
{
AfxMessageBox("Fail Initial Com!");
}
else
{
AfxMessageBox("Successfully Initial Com!");
}
hr=pCn.CreateInstance(_uuidof(Connection));
if (FAILED(hr))
{
AfxMessageBox("Fail Connection!");
}
else
{
AfxMessageBox("Successfully Connection!");
}
strconn="Provider=SQLOLEDB; Server=DONGXING2\SERVER;Database=rd; uid=sa; pwd=''";
try
{
pCn->Open((_bstr_t)strconn,"","",NULL);
}
catch(_com_error &e)
{
AfxMessageBox(e.ErrorMessage());
}
出现了不支持此接口的错误,请各位高手指点一上!!!