OLE DB Consumer Templates Reference

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at OLE DB Consumer Templates Reference.

The OLE DB Consumer Templates contain the following classes. The reference material also includes topics on the macros for OLE DB Consumer Templates.

Session Classes

CDataConnection
Manages the connection with the data source. This is a useful class for creating clients because it encapsulates necessary objects (data source and session) and some of the work you need to do when connecting to a data source.

CDataSource
Corresponds to an OLE DB data source object, representing a connection through a provider to a data source. One or more database sessions, each represented by a CSession object, can take place on a single connection.

CEnumerator
Corresponds to an OLE DB enumerator object, which retrieves rowset information about available data sources.

CEnumeratorAccessor
Used by CEnumerator to access the data from the enumerator rowset. This rowset consists of the data sources and enumerators visible from the current enumerator.

CSession
Represents a single database access session. One or more sessions can be associated with each CDataSource object.

Accessor Classes

CAccessor
Used for records that are statically bound to a data source. Use this accessor class when you know the structure of the data source.

CAccessorBase
Base class for all accessor classes.

CDynamicAccessor
An accessor that can be created at run time, based on the column information of the rowset. Use this class to retrieve data if you do not know the structure of the data source.

CDynamicParameterAccessor
An accessor that can be used when command types are unknown. Obtains the parameter information by calling the ICommandWithParameters interface, if the provider supports the interface.

CDynamicStringAccessor
Allows you to access a data source when you have no knowledge of the database's underlying structure.

CDynamicStringAccessorA
Similar to CDynamicStringAccessor except that this class requests data accessed from the data store as ANSI string data.

CDynamicStringAccessorW
Similar to CDynamicStringAccessor except that this class requests data accessed from the data store as UNICODE string data.

CManualAccessor
An accessor with methods to handle both columns and command parameters. With this class, you can use any data types as long as the provider can convert the type.

CNoAccessor
Can be used as a template argument when you do not want the class to support parameters or output columns.

CXMLAccessor
Similar to CDynamicStringAccessor except that this class converts all data accessed from the data store as XML-formatted (tagged) data.

Rowset Classes

CAccessorRowset
Encapsulates a rowset and its associated accessors.

CArrayRowset
Used to access elements of a rowset using array syntax.

CBulkRowset
Used to fetch and manipulate rows in bulk by retrieving multiple row handles with a single call.

CNoRowset
Can be used as a template argument if the command does not return a rowset.

CRestrictions
Used to specify restrictions for schema rowsets.

CRowset
Used to manipulate, set, and retrieve rowset data.

CStreamRowset
Returns an ISequentialStream object rather than a rowset; you then use the Read method to retrieve data in XML format. (SQL Server 2000 does the formatting; note that this feature works with SQL Server 2000 only.)

IRowsetNotifyImpl
Provides a dummy implementation for IRowsetNotify, with empty functions for the IRowsetNotify methods OnFieldChange, OnRowChange, and OnRowsetChange.

Schema Rowset Classes and Typedef Classes

The OLE DB Templates provide you with a set of classes that correspond to the OLE DB schema rowsets.

Command Classes

CCommand
Used to set and execute a parameter-based OLE DB command. To merely open a simple rowset, use CTable instead.

CMultipleResults
Used as a template argument for the CCommand template when you want the command to handle multiple result sets.

CNoAccessor
Used as a template argument for template classes, such as CCommand and CTable, that take an accessor class argument. Use CNoAccessor if you do not want the class to support parameters or output columns.

CNoMultipleResults
Used as a template argument for the CCommand template when you want the command to handle a single rowset. CNoMultipleResults is the default value for the template argument.

CNoRowset
Used as a template argument for CCommand or CTable if the command or table does not return a rowset.

CTable
Used to access a simple rowset with no parameters.

Property Classes

CDBPropIDSet
Used to pass an array of property IDs for which the consumer wants property information. The properties belong to one property set.

CDBPropSet
Used to set properties on a provider.

Bookmark Class

CBookmark
Used as an index for accessing data in a rowset.

Error Class

CDBErrorInfo
Used to retrieve OLE DB error information.

See Also

OLE DB Provider Templates Reference
OLE DB Templates