AnyDAC
ContentsIndexHome
PreviousUpNext
TADUpdateSQL.ModifySQL Property

Specifies the SQL statement to use when applying an update of a record.

Group
Links

Set UpdateSQL to the SQL statement to use when applying a record modification to a database. 

To submit to a command a dataset original field value, use the :OLD_<field name> parameter name. To submit to a command a new field value, use the :NEW_<field name> or :<field name> parameter name. Statement can use additional parameters and macros. To get access to the parameters or macros collection use Commands property. 

If statement fetches new record field values (identity or modified in trigger) using parameters, then to put parameter values into record, use the :NEW_<field name> or :<field name> parameter name and set parameter types to ptOuput. If statement produces result set, then it fields must have the same names as a dataset fields. 

To create an UPDATE statement at design time, use the UpdateSQL editor to create statements. For that double click on TADUpdateSQL component. Also, you can use stored procedure call or other SQL command to apply modification. 

See the Commands property for details of how to use macros or additional parameters in the command text.

property ModifySQL: TStrings;
ADUpdateSQL1.InsertSQL := 'UPDATE ADDEMO."Shippers" SET SHIPPERID = :NEW_SHIPPERID, ' +
  'COMPANYNAME = :NEW_COMPANYNAME, PHONE = :NEW_PHONE WHERE SHIPPERID = :OLD_SHIPPERID';
What do you think about this topic? Send feedback!