Discussion:
"Cursor not returned from query" with TSQLDataSet
(too old to reply)
BRebey
2008-08-06 05:50:34 UTC
Permalink
I have a problem with a BCB app calling a stored procedure on SQL Server
2005 via TSQLDataSet. I can't get a Cursor back.

The trouble appears to be with my stored procedure doing 2 "select"s. In
the procedure, the first "select" is performed, it's results are manipulated
to create a dynamic query, then that query is run as the second "select".
The procedure works like this:

insert into #tempTable
select <whatever from wherever>
set @query = <stuff based on the resutl of the first query>
execute sp_executesql @query

In the above case, I get the "no cursor returned" error when I activate my
TSQLDataSet object.

If I remove the "insert into" line and just do the two queries, I **do not
get the error**, but instead get back the result set from the *FIRST* query,
rather than the LAST query.

I tried "fooling" the system by wrapping the first select with a secondary
stored procedure and calling that procedure instead of calling the select
directly, but that didn't fool anyone. I got identical results.

How can I get the results back from the SECOND (or Nth) query?
Dmitry Arefiev
2008-08-07 04:48:22 UTC
Permalink
Hello

1) Probably adding of SET NOCOUNT ON to the top
of your procedure will help.
2) It is **always** worth to mention your Delphi version,
dbExpress driver deveoper and version.
--
With best regards,
Dmitry Arefiev
AnyDAC Team

RemObjects Software
The Infrastructure Company
http://www.remobjects.com
Loading...