Name
Execute (Connection Object)
Synopsis
Set
rsObj =
connObj
.Execute(
CommandText,_
_RecordsAffected
,
Options
)
|
(if the call to Execute returns records) |
connObj .Execute(
CommandText,
RecordsAffected, Options ) |
(if the call to Execute does not return records) |
Executes a query, SQL statement, or stored procedure. If it results in the creation of a recordset, that recordset can be immediately assigned to a Recordset object variable.
Parameters
-
rsObj
A Recordset object that you want initialized and set equal to the collection of records returned by the call to the Execute method.
-
connObj
The name of the Connection object whose Execute method you are calling.
-
CommandText
A string value representing a SQL statement, table name, stored procedure, or data provider-specific command.
-
RecordsAffected
An optional Long variable that, when the method returns, indicates how many records were affected by the call.
-
Options
See Options parameter of the Execute (Command Object) method earlier in this chapter.
Example
The following example demonstrates how you might use the Execute method of a Connection object to create a read-only, forward-only recordset from the Sales table.
<%@ LANGUAGE="VBSCRIPT" %> <% Response.Buffer = True %> <HTML> <HEAD> <TITLE>ADO Examples</TITLE> </HEAD> <BODY> <% ' Include ADOVBS.INC so we can use the ADO constants. %> <!-- #include virtual = "/bc_SSIncludes/adovbs.inc" --> <% ' Instantiate an ADO Connection object. Set objDBConn = Server.CreateObject("ADODB.Connection") ...
Get ASP in a Nutshell, 2nd Edition 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.