| Subject: | Single transaction x More than one ClientDataSet |
| Posted by: | roberto novakosky |
| Date: | Mon, 29 Mar 2010 |
I have many ClientDataSets (not nested) and I need to Apply your updates in a Single Transaction, I have the code:
//The ClientDataSets are linked this way:
//ClientDataSet1 -> DataSetProvider1 -> ADOQuery1 -> ADOConn
//So I have some CDS with some changeLogs pending... and I do transaction
try
ADOConn.BeginTrans;
if cds1.ChangeCount > 0 then
if cds1.ApplyUpdates(0) <> 0 then //OK !!! Works Fine
raise Exception.Create(‘Erro ….’);
//I am inserting here one exception to trap on except part...
raise Exception.Create(‘Error to test…’);
if cds2.ChangeCount > 0 then
if cds2.ApplyUpdates(0) <> 0 then
raise Exception.Create(‘Erro ….’);
…
//
ADOConn.CommitTrans; OK !!! Works Fine
except
on E:Exception do
begin
ADOConn.RollbackTrans; OK !!! Works Fine on DataBase, but ***
//other codes...
end;
end;
*** After ApplyUpdates from CDS1, happened rollback and the change log was cleared, but i did rollback and I need the changelog not cleared ...
Is there an automatic way to CDS do this, restoring that changelog ?
How to resolve ?
Roberto