ADO Execute Method
Definition and Usage
The Execute method can execute a query, SQL statement, or stored procedure specified in the CommandText property of the Command object.
If the CommandText property specifies a query that returns rows, any results generated by the execution will be stored in a new Recordset object. If this command is not a query that returns rows, the provider will return a closed Recordset object.
Syntax: For Commands that return rows:
Set rs=objcommand.Execute(ra,parameters,options)
Syntax: For Commands that do not return rows:
objcommand.Execute ra,parameters,options
Parameter | Description |
---|---|
ra | Optional. Returns the number of records affected by the query. For queries that return rows, use the RecordCount property of the Recordset object to calculate the number of records in the object. |
parameters | Optional. Parameter values passed with SQL statements. Used to change, update, or insert new parameter values into the Parameters collection. |
options | Optional. Indicates how the provider should calculate the CommandText property of the Command object. It can be one or more CommandTypeEnum Or ExecuteOptionEnum Value. The default is adCmdUnspecified. |
Example
<% Set objcommand.Text="SELECT * FROM Customers" objCommand.Execute %>
Or:
<% Set objcommand.Text="Customers" objCommand.Execute(,,adCmdTableDirect) %>