Attach

virtual HRESULT Attach(
IUnknown punk, BSTR bstrDM /* = NULL */);

Parameter

punk

Pointer to the IUnknown interface of an IRowset, IRowPosition, or IDataSource interface. The prior attachment will be released. This argument can be NULL to detach from a previous attachment.

bstrDM

Optional argument, used only if IDataSource is the attachment interface.

Return Code

S_OK

The method succeeded.

E_NOINTERFACE

The given IUnknown does not implement IDataSource, IRowPosition or IRowset.

Comments

Attach must be called with a valid interface before the object is usable. If punk is not NULL, it is first queried for IDataSource. If IDataSource is available, then IDataSource::GetDataMember is called with the optional data member argument. Otherwise, a query is made for IRowPosition. If IRowPosition is available, Attach calls IRowPosition::GetRowset to retrieve the IRowset interface. Otherwise, Attach queries for IRowset.