Zeos transaction error - "invalid operation in non AutoCommit mode"? lazarus / 16-Databases ---------------------------------------------------------------------- JD · 2011-03-02 01:11 Hi there everyone, I am using the code below to manage transactions in my application. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i 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]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. ---------------------------------------------------------------------- pierre.se.pos · 2011-03-02 05:47 Hi Please see the entry on StartTransaction on the following page: http://zeos.firmos.at/kb.php?mode=article&k=6 ---------------------------------------------------------------------- Zoran · 2011-03-02 08:52 Despite what you can expect, you must not use StartTransaction when AutoCommit is False! This is how AutoCommit property actually works in Zeos: when AutoCommit is True, then the transactions are commited automatically after each executed SQL statement, but you can use the StartTransaction command explicitely to prevent this auto commiting, until you explicitely call Commit. when AutoCommit is False, you should not call StartTransaction. Then the transaction is started automatically, but it will not commit automatically after every executed statement. ---------------------------------------------------------------------- JD · 2011-03-02 09:10 Thanks a lot pierre.se.pos & Zoran. I now understand how to use AutoCommit better.