Link to home
Start Free TrialLog in
Avatar of Lopcio
Lopcio

asked on

ADOQuery Select Statement with no result

When i write for example:
ADOQuery->SQL->Clear();
ADOQuery->SQL->ADD(select * from TABLE_NAME;")
ADOQuery->Open();
my aplication is working fine. There is a set o records witch is returned from the SQL Server to my aplication.

The problem appears when executing select statement on the Server returns no result, for example
select *
from MONTHS
where MONTH_NUMBER=13;
Of corse this statement returns 0 rows.

Then if I try to exec another select statement (that returns some rows this time) I have this:

" Eof or Bof are set to true or Current Record have been deleted. This operation requires current record"

My application is going crush :(
Even command ADOQuery->Close() cases this error.
Of corse if no set of rows was returned by SQL select statement,bof and eof are set to true, and I can't
have current record.
But why i can't use this ADOQuery component to another SQL select statemnets and work with any problem?

I'm not very expirienced in database-appliacation programming and this is serious problem for me.
If You know answer for my question, please help me.
Thank You very much
ASKER CERTIFIED SOLUTION
Avatar of nigelrivett
nigelrivett

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of xenon_je
xenon_je

Before using it for another query you must first close it.
the ADOQuery->Close should not create any error, maybe you left some code in there that creates the error.....
at least this is my opinion....take a better look there