Public Const adDouble = 5
Public Const AdParamInput = 1
Public Const AdParamOutput = 2
Public Const adCmdStoredProc = 4
set cn = server.createobject("adodb.connection")
cn.open "DRIVER={SQL Server};SERVER=localhost;DATABASE=asteras;Trusted_Connection=yes"
set cmd = server.createobject("adodb.command")
cmd.CommandText = "test1"
cmd.CommandType = adCmdStoredProc
set cmd.activeconnection = cn
set p = cmd.CreateParameter ("@num1", adDouble, AdParamInput, 8, 123.0 )
cmd.parameters.append p
set p = cmd.CreateParameter ("@num2", adDouble, AdParamInput, 8, 2.0 )
cmd.parameters.append p
set p = cmd.CreateParameter ("@num3", adDouble, AdParamOutput, 8, 0.0 )
cmd.parameters.append p
set p = cmd.CreateParameter ("@num4", adDouble, AdParamOutput, 8, 0.0 )
cmd.parameters.append p
cmd.execute
response.write cmd.parameters("@num3").value
response.write cmd.parameters("@num4").value
cn.close
|