Compartilhar via


BEGIN_COLUMN_MAP

Marks the beginning of a column map entry.

BEGIN_COLUMN_MAP(x )

Parameters

  • x
    [in] The name of the user record class derived from CAccessor.

Remarks

This macro is used in the case of a single accessor on a rowset. If you have multiple accessors on a rowset, use BEGIN_ACCESSOR_MAP.

The BEGIN_COLUMN_MAP macro is completed with the END_COLUMN_MAP macro. This macro is used when there is only one accessor required in the user record.

Columns correspond to fields in the rowset you want to bind.

Example

Here is a sample column and parameter map:

class CArtistsColumn
{
public:
// Data Elements
   short m_nAge;
   TCHAR m_szFirstName[21];
   TCHAR m_szLastName[31];

// Output binding map
BEGIN_COLUMN_MAP(CArtistsColumn)
   COLUMN_ENTRY(1, m_nAge)
   COLUMN_ENTRY(2, m_szFirstName)
   COLUMN_ENTRY(3, m_szLastName)
END_COLUMN_MAP()

// Parameter binding map
BEGIN_PARAM_MAP(CArtistsColumn)
   COLUMN_ENTRY(1, m_nAge)
END_PARAM_MAP()

   HRESULT OpenDataSource()
   {
      CDataSource _db;
      _db.Open();
      return m_session.Open(_db);
   }

   void CloseDataSource()
   {
      m_session.Close();
   }

   CSession m_session;

   DEFINE_COMMAND_EX(CArtistsColumn, L" \
   SELECT \
      Age, \
      FirstName, \
      LastName \
      FROM Artists \
      WHERE Age < ?")
};

Requirements

Header: atldbcli.h

See Also

Reference

END_COLUMN_MAP

COLUMN_ENTRY

COLUMN_ENTRY_EX

Other Resources

Macros and Global Functions for OLE DB Consumer Templates