Subject Re: [IBO] "Statement has not been prepared"
Author Helen Borrie
At 12:42 PM 23-09-02 +0000, you wrote:
>Thanks for that Helen
>I added 'if qry->NeedToPost' and it stopped the 'Cannot Post Row'
>messages :-) however, I still get the "Statement has not been
>prepared" message.
>When I execute:
>if qry->NeedToPost
> > {
> > qry->Post();
> > qry->IB_Transaction->Commit();
> > }
> > qry->Close();
> > qry->Unprepare();
> in FormCloseQuery, everything is hunky-dory. It seems as though
>the exception is coming when the Transaction or (TIBO_)Query is

Well, you can't Unprepare a statement that hasn't been prepared, can you?

Only call Unprepare when you are totally finished with the prepared

When you do, test it first, viz.

(apols for pascally syntax)

if qry->Prepared

Same with a transaction - you'll get an error if you call Commit on a
transaction that has not been physically started, so always test a
transaction for InTransaction or TransactionIsActive before calling Commit
or Rollback.