游标状态无效,SQLExecDirect中的SQL状态为24000 [英] Invalid cursor state, SQL state 24000 in SQLExecDirect

查看:2240
本文介绍了游标状态无效,SQLExecDirect中的SQL状态为24000的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在PHP中通过ODBC依次调用两个存储过程:

I need to call two stored procedures in sequence via ODBC in PHP:

#run stored procedure 1
$query = "Shipped_Not_Shipped_Rep ".$_GET['rep_id'];
$result = odbc_exec($dbh, $query);
odbc_result_all($result);

#run stored procedure 2
$query = "Shipped_Not_Shipped_Account ".$_GET['account_id'];
$result = odbc_exec($dbh, $query);
odbc_result_all($result);

在第二次存储过程调用后,我在PHP中收到此错误:

I'm getting this error in PHP after the second stored procedure call:


警告:odbc_exec()[function.odbc-exec]:SQL错误:
[unixODBC] [FreeTDS] [SQL Server]无效
光标状态,
中的SQL状态24000 SQLExecDirect

Warning: odbc_exec() [function.odbc-exec]: SQL error: [unixODBC][FreeTDS][SQL Server]Invalid cursor state, SQL state 24000 in SQLExecDirect

如果我重新排列我调用存储过程的顺序,总是第二个错误。有没有办法,idk,重置光标在调用之间的位置?这里有一点点元素。

If I re-arrange the order I call the stored procedures, it is always the second that errors. Is there a way to, idk, reset the cursor position between calls? A little out of my element here.

推荐答案

打开数据库的两个句柄。 ODBC可能在游标中保留游标。

Open two handles to the database. ODBC probably maintains the cursor in the handle.

这篇关于游标状态无效,SQLExecDirect中的SQL状态为24000的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆