// ADODataSet_Main.LockType := ltBatchOptimistic;
// ADODataSet_Detail.LockType := ltBatchOptimistic;
try
ADOConnection1.beginTran;
ADODataSet_Main.Insert;
// Insert Main data
ADODataSet_Main.Post;
for i := 0 to n begin
ADODataSet_Detail.Insert;
// Insert Detail data
ADODataSet_Detail.Post;
end;
ADOConnection1.commitTran;
except
ADOConnection1.RollBack;
end;
// ADODataSet_Detail.LockType := ltBatchOptimistic;
try
ADOConnection1.beginTran;
ADODataSet_Main.Insert;
// Insert Main data
ADODataSet_Main.Post;
for i := 0 to n begin
ADODataSet_Detail.Insert;
// Insert Detail data
ADODataSet_Detail.Post;
end;
ADOConnection1.commitTran;
except
ADOConnection1.RollBack;
end;