Groups | Blog | Home
all groups > sql server odbc > june 2004 >

sql server odbc : Invalid Cursor State


George
6/16/2004 6:47:09 PM
Hi all.

I have a procedure in my database whose code is more or less the
following:
CREATE PROCEDURE Fnt ( @Name nvarchar(20) ) AS
declare @number1 int;
declare @number2 int;

CREATE TABLE #Table1
(

ValueRet int,
)

set @number1=(select SUBSTRING( pol, 1 , 2 ) from table where (id IN
(select ref from table_set where num=@Name)));

set @number2=(select SUBSTRING( pol, 5 , 10 ) from table where (id IN
(select ref from table_set where num=@Name)));

insert into #Table values (@number1);
insert into #Table values (@number2);
select * from #Table;

if @@Error <> 0
begin
return @@error
end
GO


The procedure runs ok within the database. I have a problem when quering
using ODBC. I run the SQLExecDirect and it returns SUCCESS. Then I run
the SQLBind instruction and it successes again. However when running the
SQLFecth I get an error Invalid Cursor State (24000), while it should
return the query values (there are values to be returned ;)) )

Does anybody knows why that happens?
Any help is really welcome.


oj
6/17/2004 12:37:58 AM
CREATE PROCEDURE Fnt ( @Name nvarchar(20) ) AS
SET NOCOUNT ON
declare @number1 int;
declare @number2 int;

[quoted text, click to view]

AddThis Social Bookmark Button