다음을 통해 공유


BEGIN_COLUMN_MAP

Marks the beginning of a column map entry.

BEGIN_COLUMN_MAP(x )

매개 변수

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

설명

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.

예제

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

요구 사항

헤더: atldbcli.h

참고 항목

참조

END_COLUMN_MAP

COLUMN_ENTRY

COLUMN_ENTRY_EX

기타 리소스

OLE DB 소비자 템플릿에 대한 매크로 및 전역 함수