Unit 'SQLDB' Package
[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] [#fcl]

TCustomSQLQuery.ExecSQL

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

Declaration

Source position: sqldb.pp line 605

public procedure TCustomSQLQuery.ExecSQL; virtual;

Description

ExecSQL will execute the statement in TSQLQuery.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 TCustomSQLQuery.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

TCustomSQLQuery.RowsAffected

  

Return the number of rows (records) affected by the last DML/DDL statement.

TDataset.Open

  

Activate the dataset: Fetch data into memory.


Documentation generated on: Nov 22 2024