Subject Re: No Active Transaction error
Author s.beames@mailbox.gu.edu.au
I've found that if I instead use

if (result == IDYES)
DMod->tr1->CommitRetaining();
else
DMod->tr1->RollbackRetaining();

I have no problem, but I'm surprised I sometimes need an open
transaction to disconnect......could this be because of a particular
setting or relationship or event I've written? The problem occured
even on a simple query whenever a row was deleted.

Cheers,
Steve

--- In IBObjects@y..., s.beames@m... wrote:
> I have a call to a function:
>
> void __fastcall TMainForm::CloseUser()
> {
> if (DMod->tr1->TransactionIsActive)
> {
> int result = Application->MessageBox("Save your
> changes?", "Logging out...", MB_YESNO);
> if (result == IDYES)
> DMod->tr1->Commit();
> else
> DMod->tr1->Rollback();
> }
> DMod->cn1->Disconnect();
> }
>
> whenever the user logs out, or the main form closes. It's meant to
> prompt the user if he has forgotten to commit his changes.
>
> If I have been editing the master table on a form with master-
detail
> queries and haven't finished the transaction, calling the above
> results in an exception "No active transaction to execute with"
when
> the Disconnect() call is made. The next attempt to quit is
> successful. The call stack below makes me wonder if the master-
detail
> relationship is trying to update after disconnection(?).
>
> Any suggestions on how should I be doing this? I'm using 'Read
> Committed' isolation, BCB5, W98, IBO3.6De
>
-- call stack snipped --