[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'SQLDB' (#fcl)

# TSQLConnection.ExecuteDirect

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

## Declaration

Source position: sqldb.pp line 277

`public procedure TSQLConnection.ExecuteDirect(`
`SQL: string`
`); virtual; overload; procedure TSQLConnection.ExecuteDirect(`
`SQL: string;`
`ATransaction: TSQLTransaction`
`); virtual; overload;`

## Arguments

`SQL` |  | SQL statement to be executed

## Arguments

`SQL` |  | SQL statement to be executed
`ATransaction` |  | Transaction to be used. The default transaction will be used if none is passed

## 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

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