Subject Query remembering previous search
Author dr_bentonquest <correoschafa@hotmail.com>
Hi there,

I have a simple form with a TIBOQuery, a TEdit and a 'Search'
Tbutton. Here's the OnClick code:

procedure TfmMain.Button1Click(Sender: TObject);
begin
with IBOQuery1 do
try
SQL.Clear;
SQL.Add('SELECT CVEART FROM ARTICULOS WHERE CVEART=:pCve');
Params[0].AsString:=Edit1.Text;
Open;
if IsEmpty then
Showmessage('Item Not Found')
else
Showmessage('Item Found - ');
finally
Close;
end;
end;

The first time I search for an item that is not in the database, and
I get the 'Item not found' message. That is correct, but if next I
search for an item that *is* in the database, I get the same 'Item
not found' message. I think the Query is remembering the previous
search, because the same happens if the first search is for a valid
item (later I get 'Found' messages for invalid items.)

I added 'Params.Clear' before and after 'SQL.Clear' but that does not
help.

Thanks in advance for your answers,

-BQ