Subject | Re: [IBO] Problems with EOF |
---|---|
Author | Lucas Franzen |
Post date | 2005-11-08T08:24:53Z |
Hi,
see remarks below
true is nonsense.
If you really change the setting of RequestLive you have to reopen your
query since it will tell the server: "Hey, it might happen that I'm
going to send you changed data"
Sorry but it is already open, otherwise you couldn't have gone to the
first record.
So edit is just called for the first record!
(which you just call explicitely once for the first record, see above)
procedure tform1.closeCorrespondence;
begin
with qryFollowUpEmails do
begin
try
First;
while not EOF do
begin
Edit;
Fieldbyname('correspondencedate').value:=now();
Fieldbyname('status').AsString:='closed';
POST;
end;
NEXT;
except
if State in [dssEdit] then Cancel;
end
CLOSE;
end;
end;
Luc.
see remarks below
> procedure tform1.closeCorrespondence;first fetching all, then going to first then setting request live to
> begin
> qryFollowUpEmails.FetchAll;
> qryFollowUpEmails.first;
> qryFollowUpEmails.requestlive:=true;
true is nonsense.
If you really change the setting of RequestLive you have to reopen your
query since it will tell the server: "Hey, it might happen that I'm
going to send you changed data"
> qryFollowUpEmails.open;Now you open it.
Sorry but it is already open, otherwise you couldn't have gone to the
first record.
> qryFollowUpEmails. edit;Now you edit it, okay, but in the nexct line you start a loop.
So edit is just called for the first record!
> while not qryFollowUpEmails.Eof doassigning new values here will set the query back to edit mode again
> begin
> with qryFollowUpEmails do
> begin
> fieldbyname('correspondencedate').value:=now();
> Fieldbyname('status').AsString:='closed';
(which you just call explicitely once for the first record, see above)
> end;where does this next belong to?
> next;
> end;and you post once. Which is the same nonsense as editing once.
> qryFollowUpEmails.post;
> end;Maybe your code should look like:
procedure tform1.closeCorrespondence;
begin
with qryFollowUpEmails do
begin
try
First;
while not EOF do
begin
Edit;
Fieldbyname('correspondencedate').value:=now();
Fieldbyname('status').AsString:='closed';
POST;
end;
NEXT;
except
if State in [dssEdit] then Cancel;
end
CLOSE;
end;
end;
Luc.