INFO: Using ActiveX Data Objects (ADO) via OLE SDK in VC++Last reviewed: March 5, 1998Article ID: Q176342 |
The information in this article applies to:
SUMMARYThe OLE DB SDK contains two files, Adoid.h and Adoint.h, which make using ActiveX Data Objects (ADO) easier with the OLE DB SDK. This article discusses how to utilize the header files effectively.
MORE INFORMATION
Using ADOID.H and ADOINT.HAdd the \Oledbsdk\Include and \Oledbsdk\Lib folders to your path and add Adoid.lib to the link step. You may see this warning message upon compilation:
adoid.lib(adoid.obj) : warning LNK4099: PDB "dao40.pdb" was not found with "c:\oledbsdk\lib\adoid.lib" or at <path>; linking object as if no debug infoThis message can be ignored.
Before You Instantiate Any Classes Created by OLE SDKIt is important to initialize OLE before creating any instances of ADO objects using the OLE SDK. You may use the following code snippet:
struct InitOle { InitOle() { ::CoInitialize(NULL); } ~InitOle() { ::CoUninitialize(); } } _init_InitOle_;If you have any global BSTRs, this is also a good place to allocate and deallocate them.
Error HandlingWith ADO, you may receive an error in the HRESULT returned from an ADO method. This may or may not result in errors being filled in the ADO Errors Collection. The Errors collection only receives errors raised by the underlying provider (or drivers underneath that provider.) ADO errors are not populated in the collection but can be retrieved from the IErrorInfo interface. The Adovc sample demonstrates how to catch exceptions or errors with ADO. For additional information, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q174565 TITLE : FILE: Adovc.exe Demonstrates How to Use ADO with Visual C++ Passing the License Key to ADO and ADO RedistributionADO 1.0 requires a license key when run on any system that has ADO installed in a mechanism other than a Microsoft product. If the license key is already installed in the registry, then you do not need to pass a license key. Otherwise, instead of CoCreateInstance(), you use CoGetClassObject() to get a IClassFactory2 interface and CreateInstanceLic().
REFERENCES
ARTICLE-ID: Q168122 TITLE: HOWTO: Redistribute ADO 1.0 or ADO/R 1.0 with OLE/DB 1.1 ARTICLE-ID: Q168354 TITLE : INFO: Underlying OLE and OLEDB Provider Errors Exposed via ADO ARTICLE-ID: Q169496 TITLE : INFO: Using ActiveX Data Objects (ADO) via #import in VC++ ARTICLE-ID: Q175993 TITLE : INFO: Using ActiveX Data Objects (ADO) via MFC OLE in VC++ ARTICLE-ID: Q176342 TITLE : INFO: Using ActiveX Data Objects (ADO) via OLE SDK in VC++ Keywords : adoall adovc Version : WINDOWS:1.0,1.5 Platform : WINDOWS Issue type : kbhowto kbinfo |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |