ADODB.Recordset 错误 '800a0e78' 对象关闭时,不允许操作。 很奇怪的问题

cthily 2006-08-04 10:35:31
新建一个存储过程
CREATE PROCEDURE test
@id int
@typeid nvarchar(20)
as
if @typeid='h1'
begin
update table1 set a1=a1+1 where id=@id
select a1 from table1 where id=@id
end
if @typeid='h2'
beign
update table1 set a2=a2+1 where id=@id
select a2 from table1 where id=@id
end

现用下面的语句就出错
set rs=server.createobject("ADODB.Recordset")
sql="execute test "&id&",'h1' "
set rs=conn.execute(SQL)
if not rs.eof and not rs.bof then '提示说这一行出错。
total=rs(0)
end if
rs.close
set rs=nothing

请问一下是什么原因呢,谢谢。

...全文
204 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
奋斗男人 2006-08-04
  • 打赏
  • 举报
回复
将set去掉.
960379 2006-08-04
  • 打赏
  • 举报
回复
上个回复错了,没看清楚,呵呵
960379 2006-08-04
  • 打赏
  • 举报
回复
而且这句有问题:
set rs=conn.execute(SQL)
将set去掉
cthily 2006-08-04
  • 打赏
  • 举报
回复
若在存储过程 中把 update 语句去掉,则程序可以执行。

会不会存储过程那里错了。谢谢。
960379 2006-08-04
  • 打赏
  • 举报
回复
conn.execute(SQL)没有执行成功
cthily 2006-08-04
  • 打赏
  • 举报
回复
为什么呢。不懂,麻烦解释一下,谢谢。
奋斗男人 2006-08-04
  • 打赏
  • 举报
回复
在sql="execute test "&id&",'h1' "下执行rs.close()

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧