Subject Re: [IBO] using IB_query.invalidatesql, IB_query.refresh on IB_query.onpapared with IB_que
Author Daniel Rail
Hi,

At July 1, 2003, 00:55, james_027 wrote:

> Before when Iam writing a Program and when the user wants to perform
> a search what I do is get the value from the edit.text then closes
> the query and edit the query.sql then re open it again. Something
> like this

> query.close;
> query.sql[1]:='where name start with '''+edit.text+'''';
> query.open;


> Now when Iam using the IBO what I did is edit the
> IB_query.sqlwhereitems on IB_query.onprepare event when the
> IB_query.invalidatesql and IB_query.refresh is call

> Am I doing the right and the best practice?

If you mean something like this:
procedure TForm.IB_Query1OnPrepareSQL(Sender: TIB_Statement);
begin
// Check to make sure at least one character is in edit.text
if Length(edit.text)>0 then
TIB_Query(Sender).SQLWhereItems.Add('name start with '''+edit.text+'''')
end;

And in your code to refresh:
IB_Query.InvalidateSQL;
IB_Query.Refresh;


If that's what you mean, then you are on the right track.

--
Best regards,
Daniel Rail
Senior System Engineer
ACCRA Group Inc. (www.accra.ca)
ACCRA Med Software Inc. (www.filopto.com)