' Collection of code snippets by Arne Vajhøj 
' (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
adCmdStoredProc = 4
adParamInput = 1
adParamOutput = 2
adParamReturnValue = 4
adInteger = 3
Set con = CreateObject("ADODB.Connection")
con.Open "Provider=SQLOLEDB;Data Source=ARNEPC4\SQLEXPRESS;Integrated Security=SSPI;Initial Catalog=Test;"
Set cmd = CreateObject("ADODB.Command")
cmd.ActiveConnection = con
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "usp_return"
cmd.Parameters.Append(cmd.CreateParameter("@retval", adInteger, adParamReturnValue))
cmd.Parameters.Append(cmd.CreateParameter("@inarg", adInteger, adParamInput))
cmd.Parameters.Append(cmd.CreateParameter("@outarg", adInteger, adParamOutput))
cmd.Parameters("@inarg") = 123
Set rs = cmd.Execute
Do While Not rs.EOF
    WScript.Echo rs("v")
    rs.MoveNext
Loop
Set rs = Nothing
WScript.Echo cmd.Parameters("@outarg")
WScript.Echo cmd.Parameters("@retval")
Set cmd = Nothing
Set con = Nothing
