Sign in Join
FPDoc Onlineexperiment

TCustomSQLQuery.ExecSQL procedure

Member of TCustomSQLQuerypublicIn unit SQLDB

Execute a SQL statement that does not return a result set.

Declaration

pascal
procedure ExecSQL; virtual

Description

ExecSQL will execute the statement in SQL, preparing the statement if necessary. It cannot be used to get results from the database (such as returned by a SELECT statement): for this, the Open method must be used.

The SQL property should be a single SQL command. To execute multiple SQL statements, use the TSQLScript component instead.

If the statement is a DML statement, the number of deleted/updated/inserted rows can be determined using RowsAffected.

The Database and Transaction properties must be assigned before calling ExecSQL. Executing an empty SQL statement is also an error.

Errors

If the server reports an error, an exception will be raised.

See also

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.