Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How to Clear 'ODBC 24000 Invalid Cursor State'

Author  Topic 

dlaratta
Starting Member

1 Post

Posted - 2006-07-06 : 20:40:06
Hello experts. Excuse my SQL newbie status. I was writing a stored procedure to crunch some data against an MS SQL 2000 database. I didn't entirely know what I was doing so I was using Crystal Reports 11 as an "application layer" pulling against a stored procedure. Well I guess ODBC connections don't support temp table output from stored procedures, or at least I don't know how to do it.

So I've rewritten my stored procedure so it inputs and outputs data using BCP, rather than just sending a simple select query.

My problem is that I cannot get CR to add the stored procedure back in to the report. Everytime I try I get an 'ODBC 24000 error - Invalid Cursor State.'

Where is this current set of records? How do I find it and close it? I've recreated my ODBC connection, every related table and SP to no avail. This is my crusial question.

Less crucial but helpful: How do I write an SP so it can be called from a report program like CR and will return its result set to the application? What's a good, simple "application layer" I can use if I'm doing all the logic in native SQL stored procedures? ASP.NET looks like a pain in the ass, and SQL Reporting Services requires Visual Studio .NET 2003. Is Perl my answer, since I can build web interfaces and forms in my sleep?

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2006-07-06 : 20:58:16
If your stored proc returns data via BCP, CR will not be able to read it.

Your stored proc will need to return a cursor (e.g. results of a SELECT statement) before it can do anything with it.

Should also answer your second question....

HTH,

Tim
Go to Top of Page
   

- Advertisement -