JavaScript EditorDhtml editor     Free javascript download 

Main Page

To mix OLE DB consumer templates and Active Data Objects (ADO), use ADO to open a recordset (corresponding to a rowset in the OLE DB Consumer Templates). When you have a recordset, do the following to connect to an OLE DB rowset:

  1. Call QueryInterface for the IRowset and IAccessor pointers.

    В CopyCode imageCopy Code
    IRowset* lpRowset = NULL;
    IAccessor* lpAccessor = NULL;
    lpUnk->QueryInterface(IID_IRowset, (void**)&lpRowset);
    lpUnk->QueryInterface(IID_IAccessor, (void**)&lpAccessor);

    lpUnk points to the IUnknown object of the ADO recordset.

  2. Attach the accessor and rowset to their appropriate OLE DB consumer template classes.

    В CopyCode imageCopy Code
    CRowset rs;
    CAccessor accessor;
    accessor.AddAccessorInfo(0ul);      // 0 is the ordinal of an ADO accessor
    rs.m_spRowset.Attach(lpRowset);      // use the Attach method of CComPtr<>

Expand imageSee Also

JavaScript EditorDhtml editor     Free javascript download