Edit and post on the last record of a table does not set eof to true

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
ghaith
Posts: 5
Joined: Wed 27 Feb 2008 13:08

Edit and post on the last record of a table does not set eof to true

Post by ghaith » Thu 13 Mar 2008 09:14

Hey,
I'm using MyDAC 5.20.1.14 with delphi 2006

I have the following code:

Code: Select all

    
        while not Telephone.eof do begin
             Telephone.edit;
             TelephoneLedger_number.asstring:=sender.AsString;
             Telephone.post;
        end;

that seems to get stuck on the last record of the table causing an infinite loop, on other records it just posts and go to the next record as the normal behaviour i suppose
I'm merging from paradox and the same code works there normally..

Is this a problem in myDAC, or is it a new behavior for post?

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Thu 13 Mar 2008 16:23

You should scroll to the next record after post. Try this code:

Code: Select all

while not Telephone.eof do begin
     Telephone.edit;
     TelephoneLedger_number.asstring:=sender.AsString;
     Telephone.post;
     Telephone.next;
end; 

ghaith
Posts: 5
Joined: Wed 27 Feb 2008 13:08

Post by ghaith » Fri 14 Mar 2008 06:51

Hey,
Thanks for the reply,

i have thought of that but there's a problem
if i have for example 3 records in telephone, Post on the first record should get me to the second, a next after it will get me to the third record no?

Antaeus
Posts: 2098
Joined: Tue 14 Feb 2006 10:14

Post by Antaeus » Fri 14 Mar 2008 12:42

Post takes care of applying changes but not of scrolling. You can read more about TDataSet methods such as Edit, Post, Next, Prior, and others in the Delphi help.

Post Reply