... which means that I'm going to have to put Commit's into the afterScroll events to prevent these idle transactions.
Or .Rollback. No need to commit if you haven't changed anything.
Also please note that this
ONLY a problem when you use a master/details dataset.
The master dataset internally closes and opens the details dataset which in turn seem to activate the transaction.
Also the transaction is always automatically activated when opening the dataset so you could (for a master/details dataset) set the Rollback of the transaction in the AfterOpen-event. That seems to work ok.
procedure TForm1.MasterAfterOpen(DataSet: TDataSet);
begin
if SQLTransaction1.Active then
SQLTransaction1.Rollback;
end;
procedure TForm1.DetailAfterOpen(DataSet: TDataSet);
begin
if SQLTransaction1.Active then
SQLTransaction1.Rollback;
end;
Although you need to be careful with Rollback. In a Master/details dataset the details could be closed/opened while you're editing a master in which case you can loose the edits. But if you're sure it's just a read-only dataset Rollback is better.