Subject R: [IBO] Failed to post all datasets
Author Antonio Avrini
At 16.16 30/12/2003 +0100, you wrote:
>Hello to everybody,
>I'm converting a BDE application using IBO evaluation and I'm experiencing
>some troubles with transactions...
>Using TIBOQuery and TIB_Transaction I occasionally receive the error
>'E_Failed_To_Post_Datasets '(Failed to post all datasets) in the
>IB_Transaction.Commit.
>The transaction is started manually and AutoCommit is false.
>Any idea or suggestion to solve this problem ?
>Thanks and Happy New Year.

>Which is your call-stack?
>If you have a sequence of operations to commit, have you tried with
>Autocommit in order to find which operation
>is generating the exception?
>Regards
>Marco


No calls are nested, only one where the commit or rollback is called from.
The exception is always generated by calling the method commit.
Setting Autocommit=true does not change the behaviour!

The application is based on MDI form and transactions are controlled in the
following way:

(1) start transaction in the form constructor
!// ------- create MDI form and load existing document ------
!constructor TFrmMasterList_Child.CreateAndOpen(Codice: string; AOwner:
TComponent);
!begin
! inherited Create(AOwner);
! Caption := 'Master List ' + Codice;
! if not IB_Transaction.TransactionIsActive then begin
! IB_Transaction.StartTransaction;
! end;
! fIsNewDocument := False;
! LoadDocument(Codice);
! if UserCanEDit then
! Qry.Edit;
! DataChanged := False;
!end;

(2) roll back transaction before closing the form if asked to do so
!// --------- save data before close the form ---------
!procedure TFrmMasterList_Child.FormCloseQuery(Sender: TObject;var CanClose:
Boolean);
!begin
! CanClose := True;
! if DataChanged then begin
! if (Application.MessageBox('Salvare le modifiche?',
'Conferma',MB_ICONQUESTION + MB_YESNO) = idYes) then begin
! SaveData; // no transaction performed here
! end
! else begin
! if IB_Transaction.TransactionIsActive then begin
! IB_Transaction.Rollback;
! end;
! end;
! end;
!end;

(3) commit transaction before closing the form
!// --------- close and free MDI form ---------
!procedure TFrmMasterList_Child.FormClose(Sender: TObject; var Action:
TCloseAction);
!begin
! try
! if IB_Transaction.TransactionIsActive then begin
! IB_Transaction.Commit;
! end;
! finally
! Action := caFree;
! end;
!end;

What I don't understand is why the problem arise only occasionally, even
without actually changing the data.
Regards
Antonio