Creating SQL Statements for Update Components
Go Up to Using the BDE to cache updates Index
To update a record in an associated dataset, an update object uses one of three SQL statements. Each update object can only update a single table, so the object's update statements must each reference the same base table.
The three SQL statements delete, insert, and modify records cached for update. You must provide these statements as update object's DeleteSQL, InsertSQL, and ModifySQL properties. You can provide these values at design time or at run time. For example, the following code specifies a value for the DeleteSQL property at run time:
with UpdateSQL1.DeleteSQL do begin Clear; Add('DELETE FROM Inventory I'); Add('WHERE (I.ItemNo = :OLD_ItemNo)'); end;
UpdateSQL->DeleteSQL->Clear(); UpdateSQL->DeleteSQL->Add("DELETE FROM Inventory I"); UpdateSQL->DeleteSQL->Add("WHERE (I.ItemNo = :OLD_ItemNo)");
At design time, you can use the Update SQL editor to help you compose the SQL statements that apply updates.
Update objects provide automatic parameter binding for parameters that reference the dataset's original and updated field values. Typically, therefore, you insert parameters with specially formatted names when you compose the SQL statements.