Subject Re: [IBO] Problems with EOF
Author SUPER Safra - CPD
Estou com problemas na instalação do IB4.5 no delphi 2005 , sabe como faço.. ele esta instando tudo errado.
Obrigado!
----- Original Message -----
From: Lucas Franzen
To: IBObjects@yahoogroups.com
Sent: Tuesday, November 08, 2005 5:24 AM
Subject: Re: [IBO] Problems with EOF



Hi,

see remarks below

> procedure tform1.closeCorrespondence;
> begin
> qryFollowUpEmails.FetchAll;
> qryFollowUpEmails.first;
> qryFollowUpEmails.requestlive:=true;

first fetching all, then going to first then setting request live to
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 do
> begin
> with qryFollowUpEmails do
> begin
> fieldbyname('correspondencedate').value:=now();
> Fieldbyname('status').AsString:='closed';

assigning new values here will set the query back to edit mode again
(which you just call explicitely once for the first record, see above)

> end;
> next;

where does this next belong to?

> end;

> qryFollowUpEmails.post;

and you post once. Which is the same nonsense as editing once.

> 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.


___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !



------------------------------------------------------------------------------
YAHOO! GROUPS LINKS

a.. Visit your group "IBObjects" on the web.

b.. To unsubscribe from this group, send an email to:
IBObjects-unsubscribe@yahoogroups.com

c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


------------------------------------------------------------------------------



[Non-text portions of this message have been removed]