Error: Invalid operation in non AutoCommit mode

In this forum we will discuss things relating the ZEOSLib 6.6.x stable versions

Moderators: gto, EgonHugeist

Post Reply
JD
Senior Boarder
Senior Boarder
Posts: 53
Joined: 06.09.2009, 18:27

Error: Invalid operation in non AutoCommit mode

Post by JD »

Hi there everyone,

I am using the code below to manage transactions in my application.

Code: Select all

procedure TForm1.DoTransaction(DataSet: TDataSet);  
begin  
  with ZConnection1 do  
  begin  
    if not AutoCommit then  
    begin  
      StartTransaction;     //Gives me an error 'invalid operation in non AutoCommit mode'  
      try  
        Commit;  
      except  
        Rollback;  
      end;  
      Dataset.Refresh;  
    end;  
  end;  
end;  
What I find odd is that I get an error "invalid operation in non AutoCommit mode" everytime I try to update the database. I later discovered that the error is due to the line

Code: Select all

StartTransaction
Once I comment out this line, everything works fine.

Is this normal? Why should the explicit call to "StartTransaction" on a Zeos connection generate an error? Does setting "AutoCommit := False" implicitly start a transaction? Is it one or the other but not the two at the same time?

Thanks for your assistance.

JD
JD
Senior Boarder
Senior Boarder
Posts: 53
Joined: 06.09.2009, 18:27

Post by JD »

I found the answer on this page

http://zeos.firmos.at/kb.php?mode=article&k=6

Thanks for taking the time to read my posting. :)
Post Reply