Subject Re: [IBO] Refreshing a IBODataset
Author Luiz
Geoff,

----- Original Message -----
From: "Geoff Worboys (TeamIBO)" <geoff@...>
To: "Luiz" <IBObjects@yahoogroups.com>
Sent: Thursday, February 07, 2002 10:34 PM
Subject: Re: [IBO] Refreshing a IBODataset


> > If we have code on event OnPrepareSql of the TIBODataset bound a
> > TDBGrid and doing some filtering of records depending on some
> > conditions, calling in a TButton on click event code as:
> > TIBOQuery.InvalidateSQL;
> > TIBOQuery.Refresh;
>
> > After this the TBGrid bound to dataset doesn't reflect the Refresh
> > and gives AV when trying scroll it.
>
> > With IBO native datasets all works very well.
>
> Yes but the IBO native datasets have different timings etc to
> TDataset. TDataset is out of our control. You may need to find an
> alternative way of implementing your requirement.
>
> Remember that IBO native is almost entirely dynamic, whereas TDataset
> is much less so - even the IBO variation. I also know that there are
> some synchronisation issues relating to the internal native dataset
> and the external TDataset.
>
> If you explain what exactly you are trying to achieve perhaps others
> here can offer some suggestions. Perhaps you can use Filter
> properties or parameters to achieve the desired effect.

I have a TIBOQuery(qroConv), a TDBGrid(Grid1) and a TEdit(Edit1). The code
is:

procedure TfrmCadConvPlan.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if key=#13 then begin
qroConv.InvalidateSQL;
qroConv.Refresh;
end
end;

procedure TfrmCadConvPlan.qroConvPrepareSQL(Sender: TObject);
begin
if trim(Edit1.Text)<>'' then begin
case qroConv.OrderingItemNo of
1:
qroConv.SQLWhereItems.add('convenio.nconv='+inttostr(strtointdef(Edit1.Text,
-999)));
2: qroConv.SQLWhereItems.add('convenio.nome CONTAINING
'+quotedstr(Edit1.Text));
end;
end;
end;

After I put some text in Edit1 and press ENTER the code on event
TfrmCadConvPlan.Edit1KeyPress is executed. The result is that some rows
appear blank after the refresh and others are filled with data on TDBGrid.

The AV occurs when I try scroll the TDBGrid on ScrollBar.

In early post, Jason stated that this code is ok and the refresh would have
to work.
Here is the post:

>Is secure to use SqlWhereItems on OnPrepareSQL in IBODataset derived comp?

>I am trying without success make a refresh with TIBOQuery with:
>TIBOQuery.InvalidateSQL;
>TIBOQuery.Refresh;
>After this the TBGrid bound to dataset doesn't reflect the Refresh and
gives
>AV when trying scroll it.

>Does it was done to work with IBODataset staff?

>I know that with IBO native datasets works very well.

>Thanks in advance,

>Luiz.

and Jason said:

>You should be able to do what you are trying to do.
>If you showed us the code it might help.

As I was using TIBOQuery Infopower derived, Jason said:

>This sounds like a whole different issue than what you are talking about
>here.
>Please get this error to duplicate without the InfoPower and send it to me.

Then, I create a new app using TIBOQuery without InfoPower and sended it to
Jason.

Filters are not a good solution to me, because I have noted some problems
with Filters in TIBODataset. It doesn't work to me.

Parameters don't give me the flexibility that I need on this case.

Luiz