IDBCreateCommand::CreateCommand

Creates a new command.

Syntax

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.

  • E_UNEXPECTED
    ITransaction::Commit or ITransaction::Abort was called, and the object is in a zombie state.

  • 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

Reference

ICommand