OLE DB Programmer's Reference

ICommandStream::SetCommandStream

Sets the interface pointer of a stream object containing a command.

HRESULT SetCommandStream (
   REFIID      riid,
   REFGUID     rguidDialect,
   IUnknown   *pCommandStream);

Parameters

riid
[in]

Specifies the type of stream object representing the command.

rguidDialect
[in]

Specifies the dialect of the command.

If this parameter is set to DBGUID_DEFAULT, the provider uses its default dialect.

pCommandStream
[in]

Pointer to a stream object of a type specified by riid.

If pCommandStream is a null pointer, the specification of the current command stream object is cleared and the command is put in an initial state.

Return Code

S_OK
The method succeeded.
E_FAIL
A provider-specific error occurred.
E_NOINTERFACE
One of the following occurred:
  • The type of interface indicated by riid was not supported by the provider.
  • The riid specified did not match the type of stream object passed in *pCommandStream.
DB_E_DIALECTNOTSUPPORTED
The provider did not support the dialect specified in rguidDialect.
DB_E_OBJECTOPEN
The output stream returned by a previous call to ICommand::Execute is still open. Release that stream before calling this method.

Comments

ICommand::Execute uses the last command set by either ICommandStream::SetCommandStream or ICommandText::SetCommandText.

If the command is contained in a stream, ICommand::Execute uses the stream object specified at the time SetCommandStream was called, even if that stream object is subsequently modified by other means.

A provider may or may not support the same set of dialects (rguidDialect) on ICommandStream::SetCommandStream as are supported on ICommandText::SetCommandText.

See Also

ICommand::Execute | ICommandStream::GetCommandStream | ICommandText::SetCommandText