FireDAC.Comp.Client.TFDUpdateSQL.FetchRowSQL

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

property FetchRowSQL: TStrings index 5 read GetSQL write SetSQL;

C++

__property System::Classes::TStrings* FetchRowSQL = {read=GetSQL, write=SetSQL, index=5};

Properties

Type Visibility Source Unit Parent
property published
FireDAC.Comp.Client.pas
FireDAC.Comp.Client.hpp
FireDAC.Comp.Client TFDUpdateSQL

Description

Specifies an SQL statement to use to refetch a single record.

Set FetchRowSQL to an SQL statement to use when refetching a single record from a database.   To submit a dataset original field value, use the :OLD_<field name> parameter name. Statements can use additional parameters and macros. To get access to the parameters or macros collection, use the Commands property. 

If the statement returns the record field values using parameters, then use the :NEW_<field name> or :<field name> parameter name, and set the parameter type to ptInputOutput or ptOutput. If the statement produces a result set, then its fields must have the same names as the dataset fields. 

If UpdateOptions.RefreshMode is rmAll, then the FetchRowSQL command will be executed automatically after posting a new record or changes to the existing one to a database. In this case, the WHERE phrase must use the :NEW.<field name> parameter names. 

To create a SELECT statement at design time, use the UpdateSQL editor to create statements. For that, double-click the TFDUpdateSQL component. Also, you can use stored procedure calls or other SQL commands to apply record fetching. 

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

Example

FDUpdateSQL1.FetchRowSQL := 'SELECT SHIPPERID, COMPANYNAME, PHONE FROM ADDEMO."Shippers" ' +
  'WHERE SHIPPERID = :OLD_SHIPPERID';

See Also