Partager via


CCommand Class

Provides methods to set and execute a command.

template <
   class TAccessor = CNoAccessor,
   template < typename T > class TRowset = CRowset,
   class TMultiple = CNoMultipleResults 
>
class CCommand : 
   public CAccessorRowset <
      TAccessor, 
      TRowset 
   >,
   public CCommandBase,
   public TMultiple

Parameters

  • TAccessor
    The type of accessor class (such as CDynamicParameterAccessor, CDynamicStringAccessor, or CEnumeratorAccessor) that you want the command to use. The default is CNoAccessor, which specifies that the class not support parameters or output columns.

  • TRowset
    The type of rowset class (such as CArrayRowset or CNoRowset) that you want the command to use. The default is CRowset.

  • TMultiple
    To use an OLE DB command that can return multiple results, specify CMultipleResults. Otherwise, use CNoMultipleResults. For details, see IMultipleResults.

Members

Methods

Close

Closes the current command.

GetNextResult

Fetches the next result when using multiple result sets.

Open

Executes and optionally binds the command.

Inherited Methods

Create

Creates a new command for the specified session, then sets the command text.

CreateCommand

Creates a new command.

GetParameterInfo

Gets a list of the command's parameters, their names, and their types.

Prepare

Validates and optimizes the current command.

ReleaseCommand

Releases the parameter accessor if necessary, then releases the command.

SetParameterInfo

Specifies the native type of each command parameter.

Unprepare

Discards the current command execution plan.

Remarks

Use this class when you need to perform a parameter-based operation or execute a command. If you merely need to open a simple rowset, use CTable instead.

The accessor class you are using determines the method of binding parameters and data.

Note that you cannot use stored procedures with the OLE DB Provider for Jet because that provider does not support stored procedures (only constants are allowed in query strings).

Requirements

Header: atldbcli.h

See Also

Concepts

OLE DB Consumer Templates (C++)

OLE DB Consumer Templates Reference