The recommended way to create an OLE DB provider is to use the wizards to create an ATL COM project and a provider and then modify the files using the OLE DB templates. As you customize your provider, you can comment out unwanted properties and add optional interfaces.
The basic steps are as follows:
Use the ATL Project Wizard to create the basic project files and the ATL OLE DB Provider Wizard to create the provider (select ATL OLE DB Provider from the Visual C++ folder in Add Class).
Modify the code in the
Executemethod in CMyProviderRS.h. For an example, see Reading Strings Into an OLE DB Provider.
Edit the property maps in MyProviderDS.h, MyProviderSess.h, and MyProviderRS.h. The wizard creates property maps that contain all properties that a provider might implement. Go through the property maps and remove or comment out properties that your provider does not need to support.
Update the PROVIDER_COLUMN_MAP, which can be found in MyProviderRS.h. For an example, see Storing Strings In the OLE DB Provider.
When you are ready to test your provider, you can test it by trying to find the provider in a provider enumeration. For examples of test code that finds a provider in an enumeration, see the and samples or the example in Implementing A Simple Consumer.
Add any additional interfaces you want. For an example, see Enhancing the Simple Read-Only Provider.
By default, the wizards generate code that is OLE DB level 0 compliant. To ensure that your application remains level 0 compliant, do not remove any of the wizard-generated interfaces from the code.