|
AnyDAC
|
Contains the text of the SQL statement to execute for the query.
Use SQL property to specify the SQL command that a query will Execute / ExecSQL / Open.
At design time the SQL property can be edited by invoking AnyDAC Query Editor dialog. For that double click on TADCustomQuery component. The dialog offers syntax hilighting editor, query builder, ability to test query and other.
The SQL property may contain one SQL command or "batch" SQL command, consisting from few SQL command or server side programming language block of code. To execute full featured SQL script use the TADScript component.
The SQL statement in the SQL property may contain also:
For details see Preprocessing Command Text.
To improove performance on adding big SQL queries to the property using TStringList methods, surround this code into SQL.BeginUpdate / SQL.EndUpdate.
After filling this property value the Param collection will be filled automatically, if ResourceOptions.ParamCreate is True.
property SQL: TStrings;
ADQuery1.SQL.BeginUpdate; try ADQuery1.SQL.Add('SELECT ...'); ADQuery1.SQL.Add('...'); ADQuery1.SQL.Add('...'); ADQuery1.SQL.Add('WHERE ID = :ID'); finally ADQuery1.SQL.EndUpdate; end; ADQuery1.ParamByName('ID').AsInteger := 100; ADQuery1.Open;
|
What do you think about this topic? Send feedback!
|