Freigeben über


BEGIN_ACCESSOR_MAP

Marks the beginning of the accessor map entries.

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

Reference

BEGIN_ACCESSOR

END_ACCESSOR

END_ACCESSOR_MAP

Other Resources

Macros and Global Functions for OLE DB Consumer Templates