A summary of UpdateBatch and transaction processing

xiaoxiao2021-03-06  98

For some settings or submissions, if you want to make a total of all modifications, you can determine the effectiveness, you can use the LockType: = LTBATCHOPTIMISTIC, so you can. Then, each time you do, you are temporarily saved in the cache, and you must submit the library through the UpdateBatch. You can know if it has been submitted by determining whether the UpdateStatus property of the DataSet is USUNMODIFIED.

Note: For users already edit, but not submitted modifications, pay attention to prompt users to save. Since the UpdateStatus does not change before the submission, it is necessary to pay attention to determining whether adotable1.state = dsbrowse is prompted to be saved.

IF (adotable1.Updatestatus <> usmodified) or (not (adotable1.state = dsbrowse) THEN

Begin

END;

This usage can also be implemented through the transaction, and then start the transaction through the Adoconnection Begintrans before the operation, submit the modification is committrans, rollback is RollbackTrans, and it is determined whether it is in the transaction to read the IntraSaction property. There is also a shortcoming of the transaction, that is, DataSet doesn't have a transaction. If multiple DataSets use an adoconnection, if you use a transaction, you must affect additional operations. Moreover, there is a relatively expensive resource that is more expensive than the UpdateBatch, huh, at least.

转载请注明原文地址:https://www.9cbs.com/read-102386.html

New Post(0)