| title | BEGIN_ACCESSOR_MAP | Microsoft Docs | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| ms.custom | ||||||||||
| ms.date | 11/04/2016 | |||||||||
| ms.reviewer | ||||||||||
| ms.suite | ||||||||||
| ms.technology |
|
|||||||||
| ms.tgt_pltfrm | ||||||||||
| ms.topic | article | |||||||||
| f1_keywords |
|
|||||||||
| dev_langs |
|
|||||||||
| helpviewer_keywords |
|
|||||||||
| ms.assetid | e6d6e3a4-62fa-4e49-8c53-caf8c9d20091 | |||||||||
| caps.latest.revision | 8 | |||||||||
| author | mikeblome | |||||||||
| ms.author | mblome | |||||||||
| manager | ghogen | |||||||||
| translation.priority.ht |
|
|||||||||
| translation.priority.mt |
|
Marks the beginning of the accessor map entries.
BEGIN_ACCESSOR_MAP(
x
,
num
)
x
[in] The name of the user record class.
num
[in] The number of accessors in this accessor map.
In the case of multiple accessors on a rowset, you need to specify BEGIN_ACCESSOR_MAP at the beginning and use the BEGIN_ACCESSOR macro for each individual accessor. The BEGIN_ACCESSOR macro is completed with the END_ACCESSOR macro. The accessor map is completed with the END_ACCESSOR_MAP macro.
If you have only one accessor in the user record, use the macro BEGIN_COLUMN_MAP.
class CArtistsAccessor
{
public:
// Data Elements
TCHAR m_szFirstName[21];
TCHAR m_szLastName[31];
short m_nAge;
// Output binding map
BEGIN_ACCESSOR_MAP(CArtistsAccessor, 2)
BEGIN_ACCESSOR(0, true)
COLUMN_ENTRY(1, m_szFirstName)
COLUMN_ENTRY(2, m_szLastName)
END_ACCESSOR()
BEGIN_ACCESSOR(1, false) // Not an auto accessor
COLUMN_ENTRY(3, m_nAge)
END_ACCESSOR()
END_ACCESSOR_MAP()
HRESULT OpenDataSource()
{
CDataSource _db;
_db.Open();
return m_session.Open(_db);
}
void CloseDataSource()
{
m_session.Close();
}
CSession m_session;
DEFINE_COMMAND_EX(CArtistsAccessor, L" \
SELECT \
FirstName, \
LastName, \
Age \
FROM Artists")
};Header: atldbcli.h
Macros and Global Functions for OLE DB Consumer Templates
BEGIN_ACCESSOR
END_ACCESSOR
END_ACCESSOR_MAP