Subject No Active Transaction error
Author s.beames@mailbox.gu.edu.au
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

Thanks,
Steve

00440EE8 Ib_components::TIB_Statement::SysExecute(Self=:00E977B4)
0044980D Ib_components::TIB_Dataset::SysExecute(
0044919F Ib_components::TIB_Dataset::SysOpen(Self=:00E977B4)
00448BD5 Ib_components::TIB_Dataset::Open(Self=:00E977B4)
004493E0 Ib_components::TIB_Dataset::SysRefresh(Self=:00E977B4,
Rows=false, Keys=????)
00448D23 Ib_components::TIB_Dataset::RefreshKeys(Self=:00E977B4)
00445B97 Ib_components::TIB_Dataset::SysAfterParamsDataChange
(Self=:00E977B4, Sender=????, AField=????)
004659D7 Ib_components::TIB_Row::DoAfterModify(Self=????,
IB_Field=????)
00465A61 Ib_components::TIB_Row::SysApplyUpdates(Self=:00E977B4,
SingleEventOnly=????)
004659FE Ib_components::TIB_Row::EndUpdate(Self=????,
SingleEventOnly=????)
00445FEF Ib_components::TIB_Dataset::SysMasterDataChange
(Self=:00E977B4, AField=????)
00445C83 Ib_components::TIB_Dataset::IB_MasterDataChange(Self=????,
ADataLink=????, ADataSource=????, AField=NULL)
00461AF2 Ib_components::TIB_DataLink::DoDataChange(Self=????,
AField=????)
004619CE Ib_components::TIB_DataLink::SysDataChange(Self=:00E72838,
AField=:00E977B4)
004622DB Ib_components::TIB_DataLink::ProcessStatementEvent
(Self=:00E72838, AEvent=22 /* setFieldsDataChange */, Info=????)
0046044A Ib_components::TIB_DataSource::ProcessEvent(Self=:00E977B4,
AEvent=22 /* setFieldsDataChange */, Info=????)
00443C17 Ib_components::TIB_Statement::ProcessLinkEvent
(Self=:00E872BC, AEvent=22 /* setFieldsDataChange */, Info=????)
004507F7 Ib_components::TIB_Dataset::ProcessLinkEvent(Self=:00000001,
AEvent=-76, Info=????)
00441CDF Ib_components::TIB_Statement::SysAfterFieldDataChange
(Self=????, Sender=????, AField=????)
00454F6E Ib_components::TIB_BDataset::SysAfterFieldDataChange
(Self=????, Sender=????, AField=????)
004659D7 Ib_components::TIB_Row::DoAfterModify(Self=????,
IB_Field=????)
00465955 Ib_components::TIB_Row::SysAfterModify(Self=:00E977B4,
IB_Field=????)
004656F0 Ib_components::TIB_Row::ClearBuffers(Self=????,
NewRowState=????)
00447E54 Ib_components::TIB_Dataset::SysActiveChange(Self=:00E977B4)
00440B7E Ib_components::TIB_Statement::SysClose(Self=????)
00449A07 Ib_components::TIB_Dataset::SysClose(Self=:00E872BC)
00440BCF Ib_components::TIB_Statement::SysUnprepare(Self=:00E872BC)
0044A0DC Ib_components::TIB_Dataset::SysUnprepare(Self=:00E977B4)
0043FC3B Ib_components::TIB_Statement::SysDeallocate(Self=NULL,
AllowCachedHandle=true)
00436374 Ib_components::TIB_Connection::DeallocateStatements
(Self=:00000001)
00435E9E Ib_components::TIB_Connection::SysBeforeDisconnect
(Self=:00DDCE14)
00435D74 Ib_components::TIB_Connection::SysDisconnect(Self=:00E977B4)
00433778 Ib_components::TIB_Connection::Disconnect(Self=:00DDCE14)
0040226A TMainForm::CloseUser(this=:00E1092C)
004022D5 TMainForm::LogoutClick(this=:00E1092C, Sender=:00E1A340)