ExecuteSQL Method

See AlsovbmthExecuteSQLSee                 ExamplevbmthExecuteSQLEx>Low


Executes an action queryKV0EYL SQL statement29F05E5 in a specified database3GGA17.


rows = database.ExecuteSQL( sqlstatement )


The ExecuteSQL method has the following parts:

Part                 Description


rows                 The number of rows affected by the action query.  Long1DDU1E5 data type.

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

sqlstatement     A string expression1330R89 that is a valid SQL statement that does not return a recordset22S7WAF.


The ExecuteSQL method is valid only for SQL statements that do not return records.  For example, an SQL statement that uses "SELECT..." returns records, while an SQL statement that uses "DELETE..." does not.

Like Execute, ExecuteSQL doesn't return a recordset22S7WAF.

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

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

         ExecuteSQL returns the number of rows affected by the SQL statement, and 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.