2014-10-16 10:24
浏览 240

游标状态无效 - pdo_odbc FreeTDS SQL Server

We're running a completely nonchalant query and are getting the following error:

PDOException : SQLSTATE[24000]: Invalid cursor state: 0 [FreeTDS][SQL Server]Invalid cursor state (SQLExecute[0] at /builddir/build/BUILD/php-5.5.13/ext/pdo_odbc/odbc_stmt.c:254)

From PHP we're using the pdo_odbc library to connect via FreeTDS to SQLServer 2008

图片转代码服务由CSDN问答提供 功能建议

我们正在运行一个完全无关的查询并收到以下错误: < pre> PDOException:SQLSTATE [24000]:无效的游标状态:0 [FreeTDS] [SQL Server]无效的游标状态(/builddir/build/BUILD/php-5.5.13/ext/pdo_odbc/中的SQLExecute [0] odbc_stmt.c:254)

从PHP我们使用 pdo_odbc 库通过FreeTDS连接到SQLServer 2008

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • douyue1926 2014-10-16 10:28

    It transpires that it was the preceding query that was causing problems. We were using:


    to get out a single row but not doing anything with it after then. This was leaving a cursor open which was then throwing the error then next time any query was executed. For us, closing the cursor before the next query was the way forward.


    It's also worth noting that using fetchAll() (in the preceding query) is also a fix as this does not leave a cursor open.

    解决 无用
    打赏 举报

相关推荐 更多相似问题