Execute Method

See AlsolanExecuteSee                 ExamplelanExecuteX>Low

Description

Invokes an action queryKV0EYL in a specified database3GGA17.

Syntax

dbobject.Execute queryname | sqlstatement }[, options ]

querydef.Execute [ options ]

Remarks

The Execute method uses these parts:

Part                 Description

 

dbobject           The Database property of a data control.  In the Professional Edition, can also be an object variableZ3R9Q5 identifying an open Database.

queryname       A string expression1330R89 that is the name of an existing query in dbobject that performs an action, such as update, delete, or insert.

sqlstatement     A string expression that is a valid (for the specified database) SQL statement that performs an action.

querydef           In the Professional Edition, an object variable identifying an open QueryDef that performs an action.

options             A numeric expression71RISN indicating one or more option settings.  Multiple options values can be combined by adding them together.  See table below.

 

You can use the following symbolic constants and values (from DATACONS.TXT) for the options part:

Constant                                   Value      Description

 

DB_DENYWRITE                          1          In a multiuser environment, others cannot make changes to records in any table in the target recordset while the statement is running.

DB_INCONSISTENT                     16        (Default) Updates can apply to all fields of the target recordset, even if they also affect other rows of the target recordset.

DB_CONSISTENT                         32        Updates apply only to those fields that will not affect other rows of the target recordset.

DB_SQLPASSTHROUGH              64        This value causes the SQL statement to be passed to an ODBC database for processing; for example, to execute a query in an Oracle or SQL Server database.  Ignored except for ODBC remote databases.

 

If both DB_INCONSISTENT and DB_CONSISTENT are included, or if neither are included, the result is the default.

Using Execute on a query that selects records produces an error.

Like ExecuteSQL, Execute doesn't return a recordset22S7WAF.

The Execute and ExecuteSQL methods are different in the following ways:

         ExecuteSQL returns the number of rows affected by the SQL statement, while Execute does not return a value.

         ExecuteSQL operates only on a remote ODBC database such as SQL Server or Oracle.

         Execute allows setting of options that affect how the SQL statement is executed.