Data.SqlExpr.TSQLQuery.ExecSQL
Delphi
function ExecSQL(ExecDirect: Boolean = False): Integer; override;
C++
virtual int __fastcall ExecSQL(bool ExecDirect = false);
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
function | public | Data.SqlExpr.pas Data.SqlExpr.hpp |
Data.SqlExpr | TSQLQuery |
Description
Executes a query that does not return a set of records.
Call ExecSQL to execute an SQL command that does not return a set of records. This command is a query other than a SELECT query, such as an INSERT, UPDATE, DELETE, or CREATE TABLE query.
ExecDirect indicates that the query does not need to be prepared before it is executed. This parameter can be set to true if the query does not include any parameters. When ExecDirect is false, the query will be prepared before it is executed. Even when ExecDirect is false, you can avoid preparing the query every time ExecSQL is called by setting the Prepared property to true before calling ExecSQL the first time.
ExecSQL returns the number of rows affected by the executed command. This becomes the value of the RowsAffected property.
Note: Do not use ExecSQL for commands such as SELECT queries that return data. When the command returns data, use the Open method or set the Active property to true.