INFO: Wizards Use CDataSource::OpenWithServiceComponents() (190969)



The information in this article applies to:

  • Microsoft OLE DB, when used with:
    • Microsoft Visual C++, 32-bit Enterprise Edition 6.0
    • Microsoft Visual C++, 32-bit Professional Edition 6.0
    • Microsoft Visual C++, 32-bit Learning Edition 6.0

This article was previously published under Q190969

SUMMARY

CDatasource::OpenWithServiceComponents() was added to the OLE DB Templates late in the development stage and did not make it into the online documentation (it is documented in the Visual C++ 6.0 Readme).

OpenWithServiceComponents() was added to support the use of the OLE DB Service Components.

The ATL OLE DB Consumer Wizard may output code that uses CDatasource::OpenWithServiceComponents().

The MFC AppWizard, when using OLE DB support, always outputs code that uses CDatasource::OpenWithServiceComponents().

MORE INFORMATION

The OLE DB Service Components provide guaranteed functionality to OLE DB consumers above the minimum level required by OLE DB providers. The OLE DB 2.0 service components support:

  • Scrolling, Find, and bookmark support against any minimum-level OLE DB provider.
  • Updating against SQL providers.
  • Resource pooling for pooling connections in a frequent connect/disconnect scenario.
  • Automatic transaction enlistment in a Microsoft Transaction Server environment.
When using the MFC AppWizard with OLE DB support, a function C<ProjectName>Set::Open() is created. Within this function, a call to CDatasource::OpenWithServiceComponents() is made.

When using the ATL OLE DB Consumer Wizard, a function C<TableName>::OpenDataSource() is created. The following logic is used by the Consumer Wizard to determine whether CDataSource::Open() or CDataSource::OpenWithServiceComponents() is called from C<TableName>::OpenDataSource();.

  1. The Wizard checks the provider to see if it supports IRowsetChange. If supported, the wizard generates code to call CDataSource::Open(). The OLE DB Service components are not required to obtain update functionality.
  2. If the provider doesn't support IRowsetChange but does support SQL (the Wizard checks the DBPROP_SQLSUPPORT property of the DBPROPSET_DATASOURCEINFO property set), then the wizard generates code to call CDataSource::OpenWithServiceComponents(). The Service Components are required to obtain update functionality through SQL. The Microsoft Provider for Oracle is an example of such a provider.
  3. If the provider doesn't support IRowsetChange and doesn't support SQL, then the wizard will not try to set any update properties. For 2 and 3, above, the wizard also generates a comment to explain what is happening.

REFERENCES

Visual C++ 6.0 Readme

  • Readmevc.htm can be found in the root directory of CD1 of Visual C++ 6.0 or Visual Studio 6.0.
  • Documents CDataSource::OpenWithServiceComponents().

OLE DB 2.0 Readme

  • Can be found as a menu item under the OLE DB 2.0 SDK menu and Olreadme.txt can be found in the DOC directory under the Data Access SDK directory. (for example, \msdasdk\doc\olreadme.txt).
  • The Data Access SDK can be installed from the \dasdk directory on CD2 of Visual C++ 6.0 or Visual Studio 6.0.
The OLE DB 2.0 readme contains the documentation for the OLE DB Service Components.

Modification Type:MinorLast Reviewed:3/2/2005
Keywords:kbDatabase kbDTL kbinfo kbMDACNoSweep kbwizard KB190969 kbAudDeveloper