|
主题: 问一个关于存贮过程的问题!!
|
 wanghuhua
职务:普通成员
等级:1
金币:0.0
发贴:34
注册:2004/4/15 17:17:53
|
#12004/5/7 16:05:34
Dim Cmn Set Cmn= Server.CreateObject("ADODB.Command") Set Cmn.ActiveConnection = Conn Cmn.CommandText = "存贮过程名" 这里的存贮过程名要不要在sql里先定义,还是。。。。。。请大家来说说有关这方面的知识,我从一开始接触asp以来,一直对这个问题都不是太清楚,模模糊糊的
|
 绿茶
职务:普通成员
等级:8
金币:10.0
发贴:19267
注册:2000/12/28 12:10:01
|
#22004/5/7 23:02:38
先在MSSQLSERVER中写好存储过程,然后调用,并添加相对应的参数(输入/输出)
|
 janlay
职务:管理员
等级:7
金币:28.0
发贴:7244
注册:2003/11/27 18:07:11
|
#32004/5/8 9:30:37
传入参数并返回记录:Set rs=con.Execute("sp_getuserclass(" & intUser & ")",,adCmdStoredProc) 仅传入参数不返回值: Set cmd=Server.CreateObject("ADODB.Command")
cmd.ActiveConnection=con
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "sp_addhits"
cmd.Parameters.Append cmd.CreateParameter("@userid",adInteger,adParamInput,,intUser)
cmd.Execute ,,adExecuteNoRecords
Set cmd=nothing
|
 janlay
职务:管理员
等级:7
金币:28.0
发贴:7244
注册:2003/11/27 18:07:11
|
#42004/5/8 9:35:31
传入参数并返回一个值: Set cmd=Server.CreateObject("ADODB.Command")
with cmd
.ActiveConnection=con
.CommandType = adCmdStoredProc
.CommandText = "sp_getowner"
.Parameters.Append .CreateParameter("@id",adVarChar,adParamInput,12,strId)
.Parameters.Append .CreateParameter("@userid",adInteger,adParamOutput)
.Execute ,,adExecuteNoRecords
intOwner=.Parameters("@userid").Value
End With 以上代码摘自 5dblog 存储过程版,有删改
|