<%@ Language=VBScript %>
<%
'---Start connecting to the database
Dim strConnString
strConnString = "driver={SQL Server};server=songhp;uid=sa;pwd=;database=XVZDemo"
set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open strConnstring
'---End linking to database
'---Start assigning values to input parameters
Dim SelectSql, SelectRs
Dim SelectID , SelectName , SelectReturn
SelectSql = "Select Max(CompanyID) From Dim_Company"
Set SelectRs = Conn.Execute(SelectSql)
SelectID = SelectRs(0)
'---End assigning values to input parameters
Dim TiggerType
TiggerType = 3
Set Cmd = Server.CreateObject("ADODB.Command")
Set Cmd.ActiveConnection = Conn
Cmd.CommandType = 4 '---Declare this procedure as a stored procedureIf
TiggerType = 1 then
'---Start a stored procedure call with input parameters
Cmd.CommandText = "TransCompany1"
Set CmdParam = Cmd.CreateParameter("@TransID",3,1)
Cmd.Parameters.Append CmdParam
Cmd("@TransID") = SelectID
Cmd.Execute
'---End a stored procedure call with input parameters
Elseif TiggerType = 2 then
'---Start a stored procedure call with one input parameter and one output parameter
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")
'---End a stored procedure call with one input parameter and one output parameterElseif
TiggerType = 3 then
'---Start a stored procedure call with one input parameter, one output parameter and a return value
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")
'---End a stored procedure call with one input parameter, one output parameter, and one return value
End if
Conn.Close
SetConn=Nothing
Set Cmd = Nothing
Set CmdParamID = Nothing
Set CmdParamname = Nothing
Set CmdParamReturn = Nothing
%>