LiteDAC

TCustomDADataSet.Macros Property

Makes it possible to change SQL queries easily.

Class

TCustomDADataSet

Syntax

property Macros: TMacros stored False;

Remarks

With the help of macros you can easily change SQL query text at design- or runtime. Marcos extend abilities of parameters and allow to change conditions in a WHERE clause or sort order in an ORDER BY clause. You just insert &MacroName in the SQL query text and change value of macro in the Macro property editor at design time or call the MacroByName function at run time. At the time of opening the query macro is replaced by its value.

Example

LiteQuery.SQL.Text := 'SELECT * FROM Dept ORDER BY &Order';
LiteQuery.MacroByName('Order').Value:= 'DeptNo';
LiteQuery.Open; 

See Also

© 1997-2024 Devart. All Rights Reserved. Request Support DAC Forum Provide Feedback