MDAC 2.5 SDK - OLE DB Programmer's Reference
OLE DB Interfaces


 

IDBCreateCommand::CreateCommand

Creates a new command.

HRESULT CreateCommand(
   IUnknown *    pUnkOuter,
   REFIID        riid,
   IUnknown **   ppCommand);

Parameters

pUnkOuter

[in]
A pointer to the controlling IUnknown interface if the new command is being created as part of an aggregate. It is a null pointer if the command is not part of an aggregate.

riid

[in]
The IID of the interface requested on the command.

ppCommand

[out]
A pointer to memory in which to return the interface pointer on the newly created command.

Return Code

S_OK

The method succeeded.

E_FAIL

A provider-specific error occurred.

E_INVALIDARG

ppCommand was a null pointer.

E_NOINTERFACE

The command did not support the interface specified in riid.

E_OUTOFMEMORY

The provider did not have enough memory to create the command.

DB_E_NOAGGREGATION

pUnkOuter was not a null pointer, and the provider is an OLE DB 1.0 or 1.1 provider that does not support aggregation of the command object being created.

pUnkOuter was not a null pointer, and riid was not IID_IUnknown.

DB_E_OBJECTOPEN

The provider would have to open a new connection to support the operation, and DBPROP_MULTIPLECONNECTIONS is set to VARIANT_FALSE.

Comments

If the session is transacted, the command and any actions performed as a result of executing that command are within the scope of the transaction.

See Also

ICommand