Execute

Description

Executes a SQL command.

Applies to

PSCommandClass objects

Syntax

commandobject.Execute( )

Argument

Description

commandobject

A variable that contains a reference to an instance of PSCommandClass

Returns

PSCursorClass object

Usage

At runtime, Execute has the following behavior:

Application server

Runtime behavior

ASP

Creates a new RecordSet object using the SQL statement stored with the PSCommandClass object

JSP

Creates a new ResultSet object using the SQL statement stored with the PSCommandClass object

Examples

Example 1

The following example performs a database query by executing the SQL statement associated with a command object:

mycommand = myconnect.CreateCommand("SELECT * FROM
		products");
mycommand.Execute();

To use the same example in a JSP target, you must declare “mycommand” as a variable of type PSCommandClass before instantiating it and calling any methods on it.