Question

I am migrating from Delphi 7 to Delphi XE4. With Delphi XE4, I am using FIBPLUS 7.5. Delphi 7 application is running fine but I am getting a runtime error in Delphi XE4:

"Project abc.exe raised exception class EFIBClientError with message frmABC.transRead: Transaction not active"  

PAS File

var
    transRead: TpFIBTransaction;
    ...
    ...
    //transRead is used like this
    with TpFIBQuery.Create(Self) do
    begin
      Database := dbMyDB;
      Transaction := transRead;
      SQL.Add ('Select .....');
      ExecQuery;
      Close;
      Free;
    end;    

  DFM File

  object transRead: TpFIBTransaction
    DefaultDatabase = dbMyDB
    TimeoutAction = TARollback
    Left = 192
    Top = 196
  end

I have searched all pas and dfm files in entire project. I have not found any statement like this:

transRead.Active := True;

But I did find following statement at many places:

if transRead.Active then
begin
..........
..........
end

I have also seen this at some places:

transRead.Active := False;

Don't we need to activate the transaction? Is it automatically activated? Please suggest me any clue on which should I focus to get rid of this "Transaction is not active" error.

Was it helpful?

Solution 2

I just set property AutoReconnect = True of TFIBDatabase and it worked.

OTHER TIPS

There are two ways: 1. Start the Transaction before execQuery or 2. Set the optionsfield qoStartTransaction in Options of TpFibQuery like:

Options := Options + [qoStartTransaction];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top