以前用D5的时候是这样写的:
Query1.Post;
Database.StartTransaction;
Database.ApplyUpdates;
Database.CommitUpdates;而到了D7下,这样写却出错:
Query1.Post;
Database.StartTransaction;
Database.ApplyUpdates([]);
Datebase.Commit;出错信息为: A user Transaction is Already in Progress.
我试过去掉这一句:Database.ApplyUpdates([]);
不会出错,但是提交不了。谁帮忙解决一下?谢谢!!
Query1.Post;
Database.StartTransaction;
Database.ApplyUpdates;
Database.CommitUpdates;而到了D7下,这样写却出错:
Query1.Post;
Database.StartTransaction;
Database.ApplyUpdates([]);
Datebase.Commit;出错信息为: A user Transaction is Already in Progress.
我试过去掉这一句:Database.ApplyUpdates([]);
不会出错,但是提交不了。谁帮忙解决一下?谢谢!!
up
up
up
up
up
up
up
up
up
up
up
up
up
up
up
up
up
up
up
up
up
up
up
up
up
up
up
up
up
up
up
up
up
up
up
up
up
up
up
up
up
up
up
up
up
up
up
up
up
up
up
2 Cached updates are written to the database (Phase 1).If the database write is successful:1 Database changes are committed, ending the transaction.
2 Cached updates are committed, clearing the internal cache buffer (Phase 2).If the database write fails database changes are rolled back, ending the transaction.The two-phased approach allows for effective error recovery, especially when updating multiple and interrelated datasets (for example, the datasets associated with a master/detail form).
Query1.Post;
Database.ApplyUpdates([Query1]);
Database.StartTransaction;
Datebase.Commit;
DM.dbCrm.ApplyUpdates([Query1]);
DM.dbCrm.StartTransaction;
DM.dbCrm.Commit;