Page 1 of 1

Delete method not update UpdatesPending in MyQuery

Posted: Sat 25 Mar 2006 20:48
by C.F.Zwitkovits
Hi !!!
I working with MyDac 4.3.10 and Delphi 5.
I call the "Delete" method of the MyQuery component into an Loop :

MyQuery.CachedUpdates := True;
MyQuery.Open;

MyQuery.First;
While not MyQuery.Eof Do
begin
MyQuery.Delete;
MyQuery.Next;
End;

After this loop, I try update the dataset into the Database :

If Not MyConnection.InTransaction Then
MyConnection.StartTransaction;
Try
If MyQuery.UpdatesPending Then <-- FALSE !!!
MyQuery.ApplyUpdates;
MyConnection.Commit;
Except
MyQuery.RestoreUpdates;
MyConnection.Rollback;
Raise;
End;

MyQuery.CommitUpdates;

Is that a bug ??? , Please, Help Me !!!

Thank you

Posted: Mon 27 Mar 2006 14:48
by Antaeus
We couldn't reproduce the problem.
Please use a counter to count deleted records:

Code: Select all

  ...
  MyQuery.First;
  i := 0;
  while not MyQuery.Eof do begin
    MyQuery.Delete;
    inc(i);
  end;
  if i = 0 then
    ShowMessage('No records was deleted.');
  ...
If variable i is greater than zero and MyQuery.UpdatesPending=False, send us (mydac*crlab*com) a complete small sample to demonstrate the problem, including script to create and fill table. Also supply us exact version of MySQL server and MySQL client. You can see it in Info sheet of TMyConnection Editor