Post works with Insert, but not update lazarus / 16-Databases ---------------------------------------------------------------------- HatForCat · 2017-04-13 21:58 EDIT: Just noticed that the Post does save an Edit, but only for the life of the program. If I shut down and restart it, it has rolled back. Hi, using SQLdb and Data-Aware TDBEdit. I have a bunch on the Form and when I run db. Insert, fill them in and then run db.Post all is good. But if I use db.Edit and make a few TDBEdit changes, nothing is saved it just rolls back. I have an After Post (I handle any errors in the calling function) What do I need to do to make this Save the Editing? Do I have to write an SQL "UPDATE"? I am seriously hoping not, as there are 52-Columns and pretty much any of then could be changed. Makes for a huge SQL.Text as I will not know which TDBEdits were changed. 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 beginprocedure Add;begin  db.Insert;  ...  db.Post; // all good  DBSaveData(db);end; procedure Change;begin  db.Edit;  ...  db.Post; // all rolled back and no errors reported  DBSaveData(db);end; function Tdm.DBSaveData(const aQry: TSQLQuery) : Boolean;begin  Result:=False;  try    if trnMain.Active then    begin      aQry.ApplyUpdates;      trnMain.CommitRetaining;      Result:=True;    end;  except    on E: EDatabaseError do    begin      Result:=False;      trnMain.Rollback;    end;  end;end; ---------------------------------------------------------------------- mangakissa · 2017-04-14 06:11 SQLdb doesn't rollback automatically. You have to apply the update tho the the provider. 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 edit;....post;applyupdates;commit(retaining); ---------------------------------------------------------------------- HatForCat · 2017-04-15 23:05 Quote from: mangakissa on April 14, 2017, 08:11:29 amSQLdb doesn't rollback automatically. You have to apply the update tho the the provider. Thanks, but I am already doing that in the "DBSaveData(..." after the Post. ---------------------------------------------------------------------- fpcoder · 2017-04-16 04:47 I guess you need code in your Query's UpdateSQL. Example: Code: SQL  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i UPDATE items   SET item_name=:item_name WHERE item_id=:item_id ---------------------------------------------------------------------- LacaK · 2017-04-16 07:27 Can you show aQry.SQL.Text ? Is it select from single table ? What is aQry.Upda]"]>Blockedde (upWhereKeyOnly?)? Can you show SQL create table ? does table has primary key defined ? ---------------------------------------------------------------------- PatBayford · 2017-05-05 02:44 HatForCat : Does your table have a primary key? If not then update will not work in any case.