MyDAC

Updating Data with MyDAC Dataset Components

MyDAC components that are descendants from TCustomDADataSet provide different means for reflecting local changes to the server.

The first approach is to use automatic generation of update SQL statements. Using this approach you should provide a SELECT statement, everything else will be made by MyDAC automatically. In case when a SELECT statement uses multiple tables, you can use UpdatingTable property to specify which table will be updated. If UpdatingTable is blank, the table, that corresponds to the first field in the dataset, is used. This approach is the most preferable and is used in most cases.

Another approach is to set update SQL statements using SQLInsert, SQLUpdate and SQLDelete properties. Set them with SQL statements which will perform corresponding data modifications on behalf of the original statement whenever insert, update or delete operation is called. This is useful when there is no possibility to generate correct statement or you need to execute some specific statements. For example, update operations should be made with stored procedure calls.

You may also assign P:Devart.MyDac.TCustomMyDataSet.UpdateObject property with the TMyUpdateSQL class instance which holds all updating SQL statements in one place. You can generate all these SQL statements using MyDAC design time editors. For more careful customization of data update operations you can use InsertObject, ModifyObject and DeleteObject properties of TMyUpdateSQL component.

See Also

© 1997-2024 Devart. All Rights Reserved. Request Support DAC Forum Provide Feedback