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

带一个输入参数与两个输出参数的存储过程,循环显示时提示对象关闭时,不允许操作错误
SQL的存储过程代码:
  CREATE   PROCEDURE   dbo.ShopUnionShopClass
              @BigClass   int,
              @id   int   output,
              @e_name   varchar(50)   output
        as
        set   nocount   on
        begin
              if   @BigClass   is   null   return
              select   top   10   @id=id,@e_name=e_name  
                      from   dbo.[euser]  
    where   BigClass=@BigClass
              return
        end
GO
----------------------------------------
ASP调用代码:
                        <% 'ListShop(52)
DIM   MyComm,UserID,UserName
        BigClass   =   52
        Set   MyComm   =   Server.CreateObject( "ADODB.Command ")
        With   MyComm
.ActiveConnection   =   conn                     'MyConStr是数据库连接字串
.CommandText             =   "ShopUnionShopClass "           '指定存储过程名
.CommandType             =   4                                   '表明这是一个存储过程
.Prepared                   =   true                             '要求将SQL命令先行编译
'声明参数
.Parameters.append   .CreateParameter( "@BigClass ",3,1,4,BigClass)
.Parameters.append   .CreateParameter( "@id ",3,2,4)
.Parameters.append   .CreateParameter( "@e_name ",200,2,50)
Set   ShopClassRs   =   .Execute
        End   With
If   Not(ShopClassRs.Eof   And   ShopClassRs.Bof)   Then '-----这行出错
%>
                          <table   width= "100% "   border= "0 "   cellspacing= "0 "   cellpadding= "0 ">
                              <%
While   Not   ShopClassRs.Eof
%>
                              <tr>
                                  <td   height= "20 "> · <a   href= "Shop-view.asp?ID= <%=ShopClassRs( "ID ").Value%> "   title= " <%=Rs( "e_name ").Value%> "   target= "_blank "> <%=gotTopic(ShopClassRs( "e_name ").Value,12)%> </a> </td>