• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 850
  • Last Modified:

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
0
Lopcio
Asked:
Lopcio
1 Solution
 
nigelrivettCommented:
Try an exec rather than open for those queries that don't return resultsets.

Also try removing the reference to the resultset rather than closing it.
0
 
xenon_jeCommented:
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
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now