Subject Re: [IBO] Fetching Query Results......
Author Svein Erling Tysvær
Marc,

Prepare has to be called before setting the parameters, not after. Since
you use ParamByName, Prepare is called implicitly and you don't have to
worry about it at all. Change TEditCompanyDlg.OpenDataset to

procedure TEditCompanyDlg.OpenDataset;
var
i: integer;
begin
for i := 0 to ComponentCount - 1 do
begin
if Components[i] is TIB_Query then
with Components[i] as TIB_Query do
if not Active then
begin
if not Prepared then
Prepare; //This will not be called for IB_QueryCompany
Open;
end;
end;
end;

and it ought to work.

Set

At 19:27 29.03.2001 -0500, Marc Leclerc wrote:
>Now my problem is that when called on a slow link I see a message
"fetching query results" Row : ... and it fetches the whole dataset.
>procedure TEditCompanyDlg.OpenDataset;
>var
> i: integer;
>begin
> for i := 0 to ComponentCount - 1 do
> begin
> if Components[i] is TIB_Query then
> with Components[i] as TIB_Query do
> if not Active then
> begin
> Prepare;
> Open;
> end;
> end;
>end;
>
>function TEditCompanyDlg.EditExistingCompany(CompanyID: integer): integer;
>begin
> Screen.Cursor := crDefault;
> IB_QueryCompany.ParamByName('C_ID').AsInteger := CompanyID;
> try
> OpenDataset;
>
>function TEditCompanyDlg.CreateNewCompany(): integer;
>begin
> Screen.Cursor := crDefault;
> IB_QueryCompany.ParamByName('C_ID').AsInteger := -1;
> try
> OpenDataset;