CEnumerator Class

Uses an OLE DB enumerator object, which exposes the ISourcesRowset interface to return a rowset describing all data sources and enumerators.

Syntax

class CEnumerator :
   public CAccessorRowset< CAccessor <CEnumeratorAccessor >>

Requirements

Header: atldbcli.h

Members

Methods

Name Description
Find Searches through available providers (data sources) looking for one with the specified name.
GetMoniker Retrieves the IMoniker interface for the current record.
Open Opens the enumerator.

Remarks

You can retrieve the ISourcesRowset data indirectly from this class.

CEnumerator::Find

Looks for a specified name among available providers.

Syntax

bool Find(TCHAR* szSearchName) throw();

Parameters

szSearchName
[in] The name to search for.

Return Value

true if the name was found. Otherwise, false.

Remarks

This name maps to the SOURCES_NAME member of the ISourcesRowset interface.

CEnumerator::GetMoniker

Parses the display name to extract the component of the string that can be converted into a moniker.

Syntax

HRESULT GetMoniker(LPMONIKER* ppMoniker) const throw();

HRESULT GetMoniker(LPMONIKER* ppMoniker,
   LPCTSTR lpszDisplayName) const throw();

Parameters

ppMoniker
[out] The moniker parsed from the display name (CEnumeratorAccessor::m_szParseName) of the current row.

lpszDisplayName
[in] The display name to parse.

Return Value

A standard HRESULT.

CEnumerator::Open

Binds the moniker for the enumerator, if one is specified, then retrieves the rowset for the enumerator by calling ISourcesRowset::GetSourcesRowset.

Syntax

HRESULT Open(LPMONIKER pMoniker) throw();

HRESULT Open(const CLSID* pClsid = & CLSID_OLEDB_ENUMERATOR) throw();

HRESULT Open(const CEnumerator& enumerator) throw();

Parameters

pMoniker
[in] A pointer to a moniker for an enumerator.

pClsid
[in] A pointer to the CLSID of an enumerator.

enumerator
[in] A reference to an enumerator.

Return Value

A standard HRESULT.

See also

DBViewer
OLE DB Consumer Templates
OLE DB Consumer Templates Reference