template <class TObject, class TObjectBinded>
bool BindObject(TObject& Object, TObjectBinded& ObjectBinded, LPCOLESTR strURL, DBBINDURLFLAG nBindURLFlags=DBBINDURLFLAG_READ, DBIMPLICITSESSION *pImplSession=NULL, DBBINDURLSTATUS *pnBindStatus=NULL, IAuthenticate *pIAuthenticate=NULL);

Return Value

        true if successful; otherwise false.

Parameters

        [in] Object:

                A reference to one of opened COBinder, CORow and COSession-based objects.

        [in] ObjectBinded:

                A reference to one of CODataSource, COSession, CRBase, CORow and COStream based objects.

        [in] strURL:

                The canonical URL of the object for which an OLE DB object is to be returned.

        [in] nBindURLFlags:

                Bitmask of bind flags that determines how the ObjectBinded is opened.

        [in] pImplSession:

                A pointer to a DBIMPLICITSESSION structure for requiring and returning aggregation information for the implicit session object.       

        [out] pnBindStatus:

                A pointer to memory in which to return a bitmask containing warning status values for the requested bind flags.

        [in] pIAuthenticate

                Optional pointer to the caller's IAuthenticate interface

Remark

        For details, Refers to IBindResource::Bind. If failed, the returned error message is stored in ObjectBinded by default. For how to use the template function, see the example oledb25.

        Here is the example to open a updateable rowset with a root binder object.

COBinder                      RootBinder;
COTable<CRBase>    BulkRecord;

//open a binder
if(!RootBinder.Open()){
        cout<<W2T(RootBinder.m_strError)<<endl;
        return;
}

//open a updateable rowset. If failed, error message stored in BulkRecord.
if(!BindObject(RootBinder, BulkRecord, L"your UR address", DBBINDURLFLAG_READWRITE)){
        cout<<W2T(BulkRecord.m_strError)<<endl;
        return;
}
ATLASSERT(BulkRecord.IsOpen());

//process BulkRecord .......