FireDAC.Comp.Client.TFDRdbmsDataSet.Prepare

From RAD Studio API Documentation
Jump to: navigation, search

[–] Properties
Type:
procedure
function
Visibility: public
Source:
FireDAC.Comp.Client.pas
FireDAC.Comp.Client.hpp
Unit: FireDAC.Comp.Client
Parent: TFDRdbmsDataSet

Delphi

procedure Prepare;

C++

void __fastcall Prepare();

Description

Prepares the SQL command for execution.

Call the Prepare method to prepare the SQL command for execution. It is not required to call Prepare for a standard SQL command before execution, because the first Execute / ExecSQL / Open call will automatically prepare the command. However, it is required for stored procedures if you need to automatically populate the Params collection. After the command is prepared, SQLText will return the SQL command text as it is sent to the DBMS. 

To prepare the SQL command, a DBMS connection must be active; otherwise, an exception will be raised. 

After Prepare is called, the application cannot change command parameter data types and sizes. Otherwise, during the next Execute / ExecSQL / ExecProc / Open call, an exception will be raised. It is recommended to setup parameters before the Prepare call.

Example

FDQuery1.SQL.Text := 'select * from MyTab';
FDQuery1.Prepare;

See Also