Board index » delphi » Problem with ADOQuery

Problem with ADOQuery

Hello everybody,
One error message in my application occur and I can't find a solution.
I use event OnChangeComboBox to find  records in database according some
conditions.
Everything is OK until my SQL Query don't return me empty  set of records..
In such kind of case  I get error like (just on line "ADOQ1.Close;"):
Project Project1 raised exception class EOleException with msg 'Either BOF
or EOF is True, or the current record has been deleted....

I use the next code:

procedure TfrmMain.cbListChange(Sender: TObject);
begin
  XStr:=UpperCase(cbList.Text);
 ADOQ1.DisableControls;
 ADOQ1.Close;
 ADOQ1.SQL.Clear;
  XS1:='select * from List ';
 ADOQ1.SQL.Add(XS1);
  XS1:=' where (Name like "' +XStr +'%")';
 SQL.Add(XS1);
 ADOQ1.Open;
 ADOQ1.EnableControls;
end;

I would be thankful for every kind of help,
MimY

 

Re:Problem with ADOQuery


If you're using Delphi 5, download ADOExpress Upgrade 2 from the Borland website.

Bill Reynolds
Snowbound Software

Quote
"news.tel.hr" <milica.mi...@ck.hinet.hr> wrote in message <news:aommac$eb5i$1@as201.hinet.hr>...
> Hello everybody,
> One error message in my application occur and I can't find a solution.
> I use event OnChangeComboBox to find  records in database according some
> conditions.
> Everything is OK until my SQL Query don't return me empty  set of records..
> In such kind of case  I get error like (just on line "ADOQ1.Close;"):
> Project Project1 raised exception class EOleException with msg 'Either BOF
> or EOF is True, or the current record has been deleted....

> I use the next code:

> procedure TfrmMain.cbListChange(Sender: TObject);
> begin
>   XStr:=UpperCase(cbList.Text);
>  ADOQ1.DisableControls;
>  ADOQ1.Close;
>  ADOQ1.SQL.Clear;
>   XS1:='select * from List ';
>  ADOQ1.SQL.Add(XS1);
>   XS1:=' where (Name like "' +XStr +'%")';
>  SQL.Add(XS1);
>  ADOQ1.Open;
>  ADOQ1.EnableControls;
> end;

> I would be thankful for every kind of help,
> MimY

Other Threads