You can traverse a TClientDataset using First, Next, Last, Prior, FindKey, FindNearest and other functions/procedures. When you want to update data in a record you can explicitly put the record into Edit mode, change the data and Post it as in this example where the TClientDataset has been instantiated with the name of cds.
At this point the data has been added to a change log in the TClientDataset but it has not been updated in the physical database. The change log enables updates to be undone quite easily.
Alternatively, you can update the data using standard visual Data Access controls such as TDBEdit, TDBGrid and so on. Again, the data is only changed within TClientDataset and not in the real database.
You must call ApplyUpdates to actually send the updates to the real database:
ApplyUpdates is actually a function that returns the number of updates that failed. Failure could be caused by someone else updating the record. The parameter passed to ApplyUpdates specifies the number of updates that you will permit to fail. If this number is exceeded all the updates are backed out. If the number of updates is specified as -1 then it indicates that you will tolerate any number of failures. A better way of coding the ApplyUpdate might be:
if cds.ApplyUpdates(0) > 0 then ShowMessage ('Update failed');