日期:2014-05-17  浏览次数:20993 次

问一下ASP调用存储的正确语法,我写的老是调用出错
存储过程
create   procedure   pro_feibiao
as
declare   @cur_col   varchar(30)
declare   @bi_id   varchar(50)  
declare   @sql   varchar(1000)
declare   cur_col   cursor   for
select     b.name       from       sysobjects       a       ,syscolumns       b      
    where       a.name       =       'bid_item '       and       a.id       =       b.id     and   colid   between   28   and   (select  

  top   1   colid       from       sysobjects       a       ,syscolumns       b      
    where       a.name       =       'bid_item '       and       a.id       =       b.id      
    order       by     colid   desc)   order   by   colid
open   cur_col

fetch   next   from   cur_col   into   @cur_col
while   @@fetch_status   =   0  

BEGIN

set   @sql= ' '
set   @sql= 'update   bid_item   set   ' ' '+@cur_col+ ' ' '=null   where   bi_id=@bi_id '
print   @sql
exec   (@sql)

fetch   next   from   cur_col   into   @cur_col

END

close   cur_col
deallocate   cur_col


GO


ASP调用

<!--#include   file= "../function/conn.asp "-->

<   %bi_id= "20070116103436 "
    set   objCmd=Server.CreateObject( "Adodb.Command ")  
    objCmd.ActiveConnection=conn  
    objCmd.CommandText= "pro_feibiao "     '指定存储过程名称  
    objCmd.CommandType=4   '其为Stored   Procedure  
    objCmd.Prepared   =   true                                      
    objCmd.Parameters.append   objCmd.CreateParameter( "bi_id ",200,1,50,bi_id)  
    objCmd.Execute  
    response.Write   " <script> alert( '测试! ');location= 'xjkj_list.asp '; </script> "
    response.End()
    %   >
我的目的是传递bi_id参数,执行存储?
我的有错误请指点下。。

------解决方案--------------------
set no count on

存储过程第一行加上.