How can I execute a query saved in the SQLInsert, SQLUpdate, SQLDelete, or SQLRefresh
properties of a LiteDAC dataset?
The values of these properties are templates for query statements, and they cannot
be manually executed. Usually there is no need to fill these properties because
the text of the query is generated automatically.
In special cases, you can set these properties to perform more complicated processing
during a query. These properties are automatically processed by LiteDAC during the
execution of the Post, Delete, or RefreshRecord methods, and are used to construct
the query to the server. Their values can contain parameters with names of fields
in the underlying data source, which will be later replaced by appropriate data
For example, you can use the SQLInsert template to insert a row into a query instance
- Fill the SQLInsert property with the parametrized query template you want to use.
- Call Insert.
- Initialize field values of the row to insert.
- Call Post.
The value of the SQLInsert property will then be used by LiteDAC to perform the
Setting these properties is optional and allows you to automatically execute additional
SQL statements, add calls to stored procedures and functions, check input parameters,
and/or store comments during query execution. If these properties are not set, the
LiteDAC dataset object will generate the query itself using the appropriate insert,
update, delete, or refresh record syntax.