RAD Studio
ContentsIndex
PreviousUpNext
Merging Changes into Data

When you edit the data in a client dataset, all edits to the data exist only in an in-memory change log. This log can be maintained separately from the data itself, although it is completely transparent to objects that use the client dataset. That is, controls that navigate the client dataset or display its data see a view of the data that includes the changes. If you do not want to back out of changes, however, you should merge the change log into the data of the client dataset by calling the MergeChangeLog method. MergeChangeLog overwrites records in Data with any changed field values in the change log. 

After MergeChangeLog executes, Data contains a mix of existing data and any changes that were in the change log. This mix becomes the new Data baseline against which further changes can be made. MergeChangeLog clears the change log of all records and resets the ChangeCount property to 0.

Warning: Do not call MergeChangeLog for client datasets that use a provider. In this case, call ApplyUpdates to write changes to the database. For more information, see Applying updates.
Note: It is also possible to merge changes into the data of a separate client dataset if that dataset originally provided the data in the Data property. To do this, you must use a dataset provider. For an example of how to do this, see Assigning data directly.
If you do not want to use the extended undo capabilities of the change log, you can set the client dataset's LogChanges property to False. When LogChanges is False, edits are automatically merged when you post records and there is no need to call MergeChangeLog.

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!