asp中试用存储过程

function  GetUserID(OnlineSn)

OnlineSn 
=   Replace (OnlineSn, " ' " , " '' " )
Set  sqlcmd  =  Server. CreateObject ( " ADODB.Command " )
' Recordset、Command对象都可以通过ActiveConnection属性来连接Connection对象
sqlcmd.ActiveConnection  =  Conn
sqlcmd.CommandText  
=   " Login_OnLine"
sqlcmd.CommandType  =  adCmdStoredProc

set  param1  =  sqlcmd.CreateParameter( " @OnlineSn " ,adVarChar,adParamInput, 100 ,OnlineSn)
' param1 = Server.CreateObject("ADODB.Parameter")
'
param1.type = adVarChar
'
param1.Direction  = adParamInput


sqlcmd.Parameters.Append(param1)

set  param2  =  sqlcmd.CreateParameter( " @LoginTime " ,adDBTime,adParamInput,, now )
sqlcmd.Parameters.Append(param2)
vau 
= "   "
set  param3  =  sqlcmd.CreateParameter( " @UserID " ,adVarChar,adParamOutput, 100 ,vau)
sqlcmd.Parameters.Append(param3)

sqlcmd.
Execute
GetUserID 
=  param3.value

set  sqlcmd  =   nothing

end function

注意:要加上一个adovbs.inc常量对应文件

你可能感兴趣的:(存储过程)