[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freetds
Subject:    Re: [freetds] [FreeTDS][SQL Server]Invalid cursor state error when using 2 statements from a connect
From:       jklowden () schemamania ! org
Date:       2012-01-13 15:32:19
Message-ID: 20120113153219.GA22281 () oak ! schemamania ! org
[Download RAW message or body]

On Thu, Jan 05, 2012 at 07:12:48PM +0530, BALAKRISHNAN RAJKUMAR wrote:
> Hi All,
> 
> 
>         I am obtaining two handles from a connection and trying two execute
> two queries on successive lines. While the first execute statement
> succeeds, the second one reports this "invalid cursor state" error. Can we
> use more thane one statement using the same connection in FreeTDS. Could
> some one please clarify.

Please see http://www.freetds.org/faq.html#pending.  

The message is an example of the disadvantage of mediation.  DB-Library was
designed for TDS, and produces message 20019: "Attempt to initiate a 
new Adaptive Server operation with results pending".  ODBC has no
protocol-specific error message, even though it has protocol-specific,
implementation-defined *behavior*.  Unable to say anything specific, it says

	Invalid cursor state
	
which means, 

http://msdn.microsoft.com/en-us/library/windows/desktop/ms713584%28v=vs.85%29.aspx

	"A cursor was positioned on the StatementHandle by SQLFetch or
SQLFetchScroll. This error is returned by the Driver Manager if SQLFetch or
SQLFetchScroll has not returned SQL_NO_DATA, and is returned by the driver if
SQLFetch or SQLFetchScroll has returned SQL_NO_DATA."

In simpler words, you cannot call SQLExecute until SQLFetch returns SQL_NO_DATA.

HTH.  

--jkl

 
_______________________________________________
FreeTDS mailing list
FreeTDS@lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic