See Also Example
Description
Executes an action query
Syntax
rows = database.ExecuteSQL( sqlstatement )
Remarks
The ExecuteSQL method has the following parts:
Part Description
rows The number of rows affected by the action query. Long data type.
database The Database property of a data control. In the Professional Edition, can also be an object variable identifying an open Database object.
sqlstatement A string expression that is a valid SQL statement that does not return a recordset .
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 recordset
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.