🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.dbexpress
Article #200

"Cursor not returned from query" with TSQLDataSet

#200
From: BRebey
Date: Wed, 06 Aug 2008 05:48
25 lines
2065 bytes
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?
Technical Details
Message-ID: <48993b1e$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: fb4e2,afb37d4d899f3a22,start
X-Google-Attributes: gidfb4e2,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "BRebey" <Bill@Rebey.com>
Newsgroups: borland.public.cppbuilder.database.dbexpress
Subject: "Cursor not returned from query" with TSQLDataSet
Date: Wed, 6 Aug 2008 01:48:16 -0400
Lines: 27
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5512
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 71.204.226.118
Message-ID: <48993b1e$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1218001694 71.204.226.118 (5 Aug 2008 22:48:14 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newspeer1.nac.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
X-Original-Bytes: 1912