Subject Re: [IBO] In multiuser system
Author Helen Borrie
At 12:04 AM 22-10-02 +0200, you wrote:
>Dear Helen,
>Thank you very much for your prompt reply.
>The information you gave me were clear for me.
>Maybe my bad (not so good) English caused misunderstanding.
>I try to put the questions once again:
>1. Under the settings and events (you can find below)
> is the call of StartTran event necessary?
>2. Below you can find a commented area in the AfterPost and
> AfterCancel events of the master Query. I set in two different
> solutions into the following part of code (one is in the
> commented area, the other one is outside of the commented area).
> Please let me know which solution is better?

Your code *seems* to be trying to achieve Autocommit. Why do you want to
try to do this yourself? Autocommit forces a CommitRetaining whenever any
dataset posts a change.

In general, the right place to test whether your transaction is active
would not be in BeforeEdit, etc., since these events don't interact with
the server. The appropriate place to do it (if at all) in BeforePost.

If you are doing this in order to ensure that you perform a "hard" commit
after each Post, you might do better to test for TransactionIsActive as
part of your Commit and exception handling routine, i.e. before you allow
any further attempts to operate on the dataset. If the Commit fails for
some reason, you will get *another exception* if you then proceed to try to
call StartTransaction - since the previous transaction is still live and
awaiting action to resolve the exception. (One TIB_Transaction can't be
associated with the handles of multiple transactions simultaneously...)