Name

Command.Execute Method — (Versions 2.0, 2.1, 2.5, 2.6)

Synopsis

Set recordset = command.Execute(RecordsAffected, Parameters, Options)
Set stream = command.Execute(RecordsAffected, Parameters, Options)
command.Execute RecordsAffected, Parameters, Options
                  

The Execute method executes a SQL statement, query, or stored procedure specified in the Command.CommandText property value.

Arguments

RecordsAffected (Long)

Optional. Populated, by the data provider, with the number of records that were affected by the action SQL statement, query, or stored procedure (result-returning commands do not populate this parameter).

Parameters (Variant Array)

Optional. Contains the values to be passed to the SQL statement, query, or stored procedure for the parameters in which it holds.

Options (Long)

Optional. A combination of one or more CommandTypeEnum and ExecuteOptionEnum values indicating how the data provider should treat the command. The default value is -1 (no options set). The CommandTypeEnum values can also be set with the Command.CommandType property.

Returns

Recordset object
Stream object
Nothing

Description

The Execute method executes a stored procedure, SQL statement, or query against a data source. The command that is executed is dependent upon the value of the Command.CommandText property. The way in which ADO evaluates this CommandText is dependent upon the Options parameter to the Execute method.

If the CommandText value causes the Execute method to return records from the data source, these ...

Get ADO: ActiveX Data Objects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.