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.
begin
procedure 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;