template <class TObject, class TObjectCreated>
bool CreateObject(TObject& Object, TObjectCreated& ObjectCreated, LPCOLESTR strURL, LPOLESTR *pStringNewURL=NULL, 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, COSession and CORow-based objects.

        [in] ObjectCreated:

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

        [in] strURL:

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

        [out] pStringNewURL:

                A pointer to memory in which to return a string containing a provider-generated canonical URL that names the created row.   

        [in] nBindURLFlags:

                Bitmask of bind flags that determines how the ObjectCreated 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 ICreateRow::CreateRow. If failed, the returned error message is stored in ObjectCreated by default. For how to use the template function, see the example oledb25.

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

COBinder     RootBinder;
CORow         ORow;

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

//create a updateable row. If failed, error message stored in ORow.
if(!CreateObject(RootBinder, ORow, L"your UR address", NULL, DBBINDURLFLAG_READWRITE)){
        cout<<W2T(ORow.m_strError)<<endl;
        return;
}
ATLASSERT(ORow.IsOpen());

//process ORow .......