IDataSource::getDataMember

Returns a data access object (such as a row position) for a given data member.

HRESULT getDataMember(
DataMember   bstrDM
REFIID   riid
IUnknown   ** ppunk);

Parameters

bstrDM [in]

A string that describes the data member that represents one or more sets of data supported by the data source.

riid [in]

The interface identifier of the specified data access object.

ppunk [out]

The pointer of the returned interface.

Return Code

S_OK

The method succeeded.

E_FAIL

A provider-specific error occurred.

E_NOINTERFACE

Does not support the specified data access object.

Comments

If the data access object is not available, then Null should be returned for the IUnknown. If the data member string is invalid, then an error should be returned indicating its problem (using ISupportErrorInfo if necessary). The default data member is specified by either a zero-length string or a Null string (they are equivalent). The caller can specify which type of data access object it is interested in by specifying an IID of the main data access interface for the object—for example, IID_IRowPosition, IID_ISimpleTabularData, IID_IRowset, IID_ICursor, IID_IVBDSC, and so forth. If the data source does not support the desired data access object, it returns E_NOINTERFACE. This allows the consumer to try multiple interfaces in order of preference. When asked for IID_IUnknown, the data source should return the data access object that is natural for it.

Note   The return value from GetDataMember is always an IUnknown pointer, regardless of the specified IID. The caller of the method must query for the appropriate interface. That is, the IID parameter does not specify which interface, but rather which data access object type to return.