Partager via


Microsoft Visual C++

Important

This feature will be removed in a future version of Windows. Avoid using this feature in new development work, and plan to modify applications that currently use this feature. Instead, write a fully functional OLE DB provider using the native OLE DB interfaces.

Information and Guidelines

Following is an outline of the basic steps needed to build an OLE DB Simple Provider in Visual C++.

To build the OSP component using Visual C++

  1. Create an Automation object with standard registration.

  2. Implement IDataSource on the object.

  3. Implement the methods for OLEDBSimpleProvider with the object (at least once).

Registration

In Visual C++, you create your own ProgID for the OSP Data Object and use it when registering the OLE DB provider. Because you control the DLLRegisterServer function, you can use it to write the registry entries instead of running a copy of the supplied RegisterProvider.reg file.

Programming Notes

  • When compiling in Visual C++, be sure to point to the Include directory where the OLE DB and OLEDBSimpleProvider header files are located.

  • When linking in Visual C++, be sure to add the path for the LIB files so that you can link the LIB file containing the IIDs for the OSP interfaces and classes.

  • In Visual C++ implementations, use IDataSource to expose the correct OSP implementation to the OLE DB Simple Provider DLL (Msdaosp.dll).

  • When coding data source notifications in Visual C++, use the addDataSourceListener and removeDataSourceListener methods of IDataSource to add and remove listeners.