Subject RE: [IBO] Re: Problem with triggers
Author Helen Borrie
At 04:49 PM 6/04/2004 -0400, you wrote:
>Just a note to all, I got everything working just fine. There was never a
>problem
>When I switched these two statements around, such as:
>
>if not IB_Transaction.Started then IB_Transaction.StartTransaction;
>if not Prepared then Prepare;
>
>I got a very nasty exception, trying to read memory at a very low address.
>Both the IB_Transaction: TIB_Transaction; and the IBODQuery: TIB_DSQL;
>where components I dropped on my DataModule form. Also as another point in
>interest, I was able to hook the TIB_DSQL component up to my connection,
>but the TIB_Transaction would not allow me to select the connection as
>design time. (It kept going back to Default)
>
>Any thoughts on this?

Yes: it sounds wrong. Could you check the creation order? The AV
suggests that the ib_dsql is already in a transaction with a different
transaction than the one you thought, i.e. the default transaction.

A prepare has to occur inside the context of a transaction, you see; and a
transaction has to have at least one connection context. It's the
*statement* that gets prepared, you see. Your statement will prepare
within a certain transaction and all that prepared stuff belongs to the
transaction that prepared it.
You have two transactions playing in this sandbox, where you need to have
one, i.e. the one that you are controlling in the code.

Helen