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

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



Specifies the type of stream object representing the command.



Specifies the dialect of the command.

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



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.


The method succeeded.


A provider-specific error occurred.


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.


The provider did not support the dialect specified in rguidDialect.


The output stream returned by a previous call to ICommand::Execute is still open. Release that stream before calling this method.

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.