主题:存储过程返回值 高分相送 一个价格表 mis_roomtype_price 字段 start_time end_time price_a price_c price_d content 属性 datetime datetime int int int nvarchar 现创建了一个存储过程 -----过程开始----- CREATE Proc mis_search @begin datetime, @end datetime as select start_time, end_time= (select isnull(min(start_time),a.end_time) from mis_roomtype_price where start_time>a.start_time), price_a,price_b,price_c,bb=identity(int,1,1) into #b from mis_roomtype_price a where end_time>=@begin and start_time<=@end select *,bb=identity(int,1,1) into #c from mis_roomtype_price where end_time>=@begin and start_time<=@end ------------------------------------------ delete from #b where end_time<@begin update #b set start_time=(case when start_time<@begin then @begin else start_time end) where bb in(select min(bb) from #b) update #b set end_time=case when #b.end_time>#c.End_time then #c.end_time else #b.end_time end from #b inner join #c on #b.bb=#c.bb ---------------------------- update #b set start_time=a.end_time from #b inner join #b a on(#b.bb=a.bb+1) select start_time,end_time,price_a,price_b,price_c from #b --------------------------过程结束-------------------------- 我想取得price_a price_b的值,如果做? 刚接触.多谢帮忙 提供一个例子,如下 <%@ Language=VBScript %> <% Dim CmdSP Dim adoRS Dim adCmdSPStoredProc Dim adParamReturnValue Dim adParaminput Dim adParamOutput Dim adInteger Dim iVal Dim oVal Dim adoField Dim adVarChar '这些值在 VB 中是预定义常量,可以直接调用,但在 VBScript 中没有预定义 adCmdSPStoredProc = 4 adParamReturnValue = 4 adParaminput = 1 adParamOutput = 2 adInteger = 3 adVarChar = 200 iVal = 5 oVal = 3 '建一个command对象 set CmdSP = Server.CreateObject("ADODB.Command") '建立连结 CmdSP.ActiveConnection = "Driver={SQL Server};server=hrc-john;Uid=sa;Pwd=hrc;Database=hrc-mis" '定义command 对象调用名称 CmdSP.CommandText = "mis_search" '设置command调用类型是存储过程 (adCmdSPStoredProc = 4) CmdSP.CommandType = adCmdSPStoredProc '往command 对象中加参数 '定义存储过程有直接返回值,并且是个整数,省缺值是4 'CmdSP.Parameters.Append CmdSP.CreateParameter("RETURN_VALUE", adInteger, adParamReturnValue, 4) '定义一个字符型输入参数 CmdSP.Parameters.Append CmdSP.CreateParameter("@end", adVarChar, adParaminput, 20, "M") '定义一个整型输入参数 'CmdSP.Parameters.Append CmdSP.CreateParameter("@intID", adInteger, adParamInput, , iVal) '定义一个整型输出参数 'CmdSP.Parameters.Append CmdSP.CreateParameter("@intIDOut", adInteger, adParamOutput, oVal) '运行存储过程,并得到返回记录集 Set adoRS = CmdSP.Execute '把每个记录打印出来,其中的字段是虚拟的,可以不用管 While Not adoRS.EOF for each adoField in adoRS.Fields Response.Write adoField.Name & "=" & adoField.Value & "<br/>" & vbCRLF Next Response.Write "<br/>" adoRS.MoveNext Wend '打印两个输出值: 'Response.Write "<p>@intIDOut = “ & CmdSP.Parameters("@end").Value & "</p>" Response.Write "<p>Return value = " & CmdSP.Parameters("RETURN_VALUE").Value & "</p>" Set adoRS = nothing Set CmdSP.ActiveConnection = nothing Set CmdSP = nothing %>
该问题已经结贴 ,得分记录:mymyal123(50)、fcuandy(50)、 |