+ -
当前位置:首页 → 问答吧 → 有点急 求解asp调用带参数的存储过程代码

有点急 求解asp调用带参数的存储过程代码

时间:2011-09-01

来源:互联网

VBScript code

if exists(select name from sysobjects where name='getlist')
drop PROCEDURE getlist
go
CREATE PROCEDURE dbo.getlist
@bigclassid int,
@smallclassid int
AS
BEGIN
    SET NOCOUNT ON;
       SELECT total= Count(*) From dbo.Food_Biz WHERE BigClassID=@bigclassid AND SmallClassID=@smallclassid And ClassID=0 AND (Del<>'1' Or Del Is Null)   
end
GO
exec getlist '1','10'


需要进行统计 页面上输出total值 上面的是通过
不知道asp页面如何调用
我的以下代码会报错:
VBScript code

<%Set MyRst  = Conn.Execute("getlist '"&bigclassID&"','"&smallclassid&"'",0,4)%>


错误信息是:语法错误、违反权限或其他非特定错误

作者: bastever   发布时间: 2011-09-01

VBScript code

<%
Set oCommand = CreateObject("ADODB.Command")
With oCommand
    .CommandText = "getlist"
    .CommandType = 4
    Set oPara = .CreateParameter("@bigclassid", 3, 1, 4, bigclassID)
    .Parameters.Append oPara
    Set oPara = .CreateParameter("@smallclassid", 3, 1, 4, smallclassid)
    .Parameters.Append oPara
    Set .ActiveConnection = Conn
    Set oRS = .Execute()
    Set .ActiveConnection = Nothing
    Response.Write oRS(0)
End With
With oConn
    If .State<>0 Then .Close
End With
Set oConn = Nothing
Set oPara = Nothing
Set oCommand = Nothing
%>

作者: hookee   发布时间: 2011-09-02

热门下载

更多