Using TFDUpdateSQL is optional for TFDQuery and TFDTable because these components can generate statements automatically, that can sometimes be used for posting updates from a dataset to the database. For updating a dataset that is delivered into an FDStoredProc object, use of the TFDUpdateSQL is not optional. The developer must figure out a statement that will result in the desired updates. If only one table is updated, a direct DML statement might be sufficient. Where multiple tables are affected, an executable stored procedure will be unavoidable.

    We recommend that you always use it, even in the simplest cases, to give yourself full control over the queries that are requested from your application.

    To specify the SQL DML statements at design time, double-click on the TFDUpdateSQL component in your data module to open the property editor.

    Figure 3. TFDUpdateSQL property editor

    fbdevgd30 delphi 003

    Figure 4. TFDUpdateSQL SQL command editor

    The Options Tab

    The Options tab contains some properties that can affect the process of query generation. These properties are not related to the TFDUpdateSQL component itself. Rather, for convenience, they are references to the UpdateOptions properties of the dataset that has the current TFDUpdateSQL specified in its property.

    Notice that, because the TFDUpdateSQL component does not execute modification queries directly, it has no Transaction property. It acts as a replacement for queries automatically generated in the parent TFDRdbmsDataSet.