Skip to content

Latest commit

 

History

History
118 lines (100 loc) · 2.48 KB

File metadata and controls

118 lines (100 loc) · 2.48 KB
title BEGIN_ACCESSOR_MAP | Microsoft Docs
ms.custom
ms.date 11/04/2016
ms.reviewer
ms.suite
ms.technology
cpp-windows
ms.tgt_pltfrm
ms.topic article
f1_keywords
BEGIN_ACCESSOR_MAP
dev_langs
C++
helpviewer_keywords
BEGIN_ACCESSOR_MAP macro
ms.assetid e6d6e3a4-62fa-4e49-8c53-caf8c9d20091
caps.latest.revision 8
author mikeblome
ms.author mblome
manager ghogen
translation.priority.ht
de-de
es-es
fr-fr
it-it
ja-jp
ko-kr
ru-ru
zh-cn
zh-tw
translation.priority.mt
cs-cz
pl-pl
pt-br
tr-tr

BEGIN_ACCESSOR_MAP

Marks the beginning of the accessor map entries.

Syntax

  
BEGIN_ACCESSOR_MAP(  
x  
,   
num  
 )  
  

Parameters

x
[in] The name of the user record class.

num
[in] The number of accessors in this accessor map.

Remarks

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.

Example

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")
};

Requirements

Header: atldbcli.h

See Also

Macros and Global Functions for OLE DB Consumer Templates
BEGIN_ACCESSOR
END_ACCESSOR
END_ACCESSOR_MAP