Skip to content

TSQLConnection.ExecuteDirect

Execute a piece of SQL code directly, using a Transaction if specified.

Declaration

Source position: sqldb.pp line 301

public 
procedure ExecuteDirect(SQL: string);  virtual;  overload; overload;

procedure ExecuteDirect(SQL: string; ATransaction: TSQLTransaction)
                       ;  virtual;  overload; overload;

Description

ExecuteDirect executes an SQL statement directly. If ATransaction is Nil then the default transaction is used, otherwise the specified transaction is used.

ExecuteDirect does not offer support for parameters, so only statements that do not need parsing and parameters substitution can be handled. If parameter substitution is required, use a TSQLQuery component and its ExecSQL method.

Errors

If no transaction is assigned, and no transaction is passed, an exception will be raised.

See also

Name Description
TSQLQuery Class to handle SQL commands (with or without result set).
ExecSQL Execute a SQL statement that does not return a result set.