当前位置: 代码迷 >> ASP >> 存储过程调用异常
  详细解决方案

存储过程调用异常

热度:268   发布时间:2012-03-03 15:33:03.0
存储过程调用错误
过程如下:
CREATE   PROCEDURE   [dbo].[pub_topn]
(  
@inttopn     int,
@strtable   varchar
)  
  AS  
exec( 'SELECT   top   '   +   @inttopn   +   '     *     FROM   '+   @strtable);
GO

调用如下:
Sql   =   "Execute   Pub_topn   @inttopn= "   &   5   & ",@strtable= ' "   &   tb_topic   &   " ' "
'Response.Write(Sql)
Rs.open   Sql,Conn,1,1

提示错误如下:
多步   OLE   DB   操作产生错误。如果可能,请检查每个   OLE   DB   状态值。没有工作被完成。

------解决方案--------------------
确保tb_topic正确的话,试试用ado的command对象调用存储过程
------解决方案--------------------
Sql = "Execute Pub_topn @inttopn= " & 5 & ",@strtable= ' " & tb_topic & " ' "
变成:
Sql = "Execute Pub_topn "&5& " ' "&tb_topic& " ' "

  相关解决方案