Error dataset.post when cachedupdates = true

The official tester's forum for ZeosLib 7.1. Ask for help, post proposals or solutions.
Post Reply
KDijksman
Fresh Boarder
Fresh Boarder
Posts: 1
Joined: 30.03.2015, 16:01

Error dataset.post when cachedupdates = true

Post by KDijksman »

Hi,

I am using Zeos Zeos 7.1.3-stable with Delphi 2010 and Firebird 2.5. I have the following code:

Code: Select all

  ZQuery1.CachedUpdates := true;
  ZQuery1.Open;
  ZQuery1.First;
  if not ZQuery1.Eof then
  begin
    Zquery1.Insert;
    Zquery1.FieldByName('ID').AsInteger := 1;
    Zquery1.FieldByName('MACHINECODE').AsString := 'A01';
    ZQuery1.Post;
    if ZQuery1.UpdatesPending then
    begin
      ZQuery1.ApplyUpdates;
      ZQuery1.CommitUpdates;
    end;

    Zquery1.Edit;
    Zquery1.FieldByName('MACHINECODE').AsString := 'A02';
    ZQuery1.Post;
    if ZQuery1.UpdatesPending then
    begin
      ZQuery1.ApplyUpdates;
      ZQuery1.CommitUpdates;
    end;
  end;
First I create a new record in the database. Then I edit the same record. On the second ZQuery1.Post I get the following error:
'Cannot update a deleted row'. If CachedUpdates = false there is no error. The problem is in the commitupdates. When i do not execute the commitupdates there is no error. Does anyone know what the problem is?

Thanks in advance.

Kind regards,
Kees
Post Reply