Transactin and Rollback.



Hi

Why the code below , don´t do a Rollback in the insert in the first table,
DsetStockDoc.?
Only do the Rollback of the inserts in the cicle FOR!

Thanks in advance

Vimar

dtmpri.cnx_cv2.BeginTrans;
dtmpri.cnx_cv2.IsolationLevel:=ilReadCommitted ;
try
dsetStocKDoc.Insert;
....
...
dsetStockDoc.Post;
// a inserting detail
for i:= 1 to sgrid.RowCount - 1 do
begin
dsetStockDoc_detalhe.Insert;
.....
.....
dsetStockDoc_detalhe.post;
end;
dtmpri.cnx_cv2.CommitTrans;
except
on E:Exception do
begin
dtmpri.cnx_cv2.RollbackTrans;
messagedlg( ' Doc not Saved.
ERROR='+e.Message,mtwarning,[mbok],0);
end;
end;


.