How to use ADO without #import directive?
-
hello, Can any has code that tells how to use ADO without #import directive?? I am trying to use because you have to hard code path or ado15.dll in ado. here is my code but CoCreateInstance failed. I am initializinf COM, importing ADO header files, and liniking ado lib file. ************************* ADOConnection* pAdoConnection; HRESULT hr; // Create instances of ADOConnection hr = CoCreateInstance(CLSID_CADOConnection, NULL, CLSCTX_INPROC_SERVER, IID_IADOConnection, reinterpret_cast(&pAdoConnection) ); if ( FAILED(hr) ) { AfxMessageBox("CreateInstance failed!"); return; } // Call ADOConnection's Open method to connect to a database hr = pAdoConnection->Open((BSTR)"Kruse", (BSTR)"", (BSTR)"", -1); if ( ! FAILED(hr) ) { AfxMessageBox("open failed"); return; } *************************** thanks in advance mahesh