'---開(kāi)始鏈接數(shù)據(jù)庫(kù)
Dim strConnString
strConnString = "driver={SQL Server};server=songhp;uid=sa;pwd=;database=XVZDemo"
set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open strConnstring
'---結(jié)束鏈接數(shù)據(jù)庫(kù)
'---開(kāi)始為輸入?yún)?shù)賦值
Dim SelectSql , SelectRs
Dim SelectID , SelectName , SelectReturn
SelectSql = "Select Max(CompanyID) From Dim_Company"
Set SelectRs = Conn.Execute(SelectSql)
SelectID = SelectRs(0)
'---結(jié)束為輸入?yún)?shù)賦值
Dim TiggerType
TiggerType = 3
Set Cmd = Server.CreateObject("ADODB.Command")
Set Cmd.ActiveConnection = Conn
Cmd.CommandType = 4 '---聲明此過(guò)程為存儲(chǔ)過(guò)程
If TiggerType = 1 then
'---開(kāi)始一個(gè)輸入?yún)?shù)的存儲(chǔ)過(guò)程調(diào)用
Cmd.CommandText = "TransCompany1"
Set CmdParam = Cmd.CreateParameter("@TransID",3,1)
Cmd.Parameters.Append CmdParam
Cmd("@TransID") = SelectID
Cmd.Execute
'---結(jié)束一個(gè)輸入?yún)?shù)的存儲(chǔ)過(guò)程調(diào)用
Elseif TiggerType = 2 then
'---開(kāi)始一個(gè)輸入?yún)?shù),一個(gè)輸出參數(shù)的存儲(chǔ)過(guò)程調(diào)用
Cmd.CommandText = "TransCompany2"
Set CmdParamID = Cmd.CreateParameter("@TransID",3,1)
Cmd.Parameters.Append CmdParamID
Cmd("@TransID") = SelectID
Set CmdParamName = Cmd.CreateParameter("@TransName",202,2,50)
Cmd.Parameters.Append CmdParamName
Cmd.Execute
SelectName = Cmd("@TransName")
'---結(jié)束一個(gè)輸入?yún)?shù),一個(gè)輸出參數(shù)的存儲(chǔ)過(guò)程調(diào)用
Elseif TiggerType = 3 then
'---開(kāi)始一個(gè)輸入?yún)?shù),一個(gè)輸出參數(shù),一個(gè)返回值的存儲(chǔ)過(guò)程調(diào)用
Cmd.CommandText = "TransCompany3"
Set CmdParamReturn = Cmd.CreateParameter("Return_Value",3,4)
Cmd.Parameters.Append CmdParamReturn
Set CmdParamID = Cmd.CreateParameter("@TransID",3,1)
Cmd.Parameters.Append CmdParamID
Cmd("@TransID") = SelectID
Set CmdParamName = Cmd.CreateParameter("@TransName",202,2,50)
Cmd.Parameters.Append CmdParamName
Cmd.Execute
SelectName = Cmd("@TransName")
SelectReturn = Cmd("Return_Value")
'---結(jié)束一個(gè)輸入?yún)?shù),一個(gè)輸出參數(shù),一個(gè)返回值的存儲(chǔ)過(guò)程調(diào)用
End if
Conn.Close
Set Conn = Nothing
Set Cmd = Nothing
Set CmdParamID = Nothing
Set CmdParamname = Nothing
Set CmdParamReturn = Nothing
%>
【 微信掃一掃 】