1) Stored procedures, no input, no output:
YourConnection.Execute "EXEC YourStoredProc"
2) Stored procedures, return recordset, input variables:
YourRecordset.Open "EXEC YourStoredProc '" & YourStringVar & "'," & Cstr(YourNumericVar),YourConnection
3) Stored procedures with output parameters:
----------------------------------------
With YourCommand
.ActiveConnection = YourConnection
.CommandText = "YourStoredProc"
.CommandType = AdCmdStoredProc
.Parameters.Append .CreateParameter("@ServerVarCharIn", adVarChar, adParamInput, 255)
p.Append .CreateParameter("@ServerIntegerIn, adInteger, adParamOutput)
p.Append .CreateParameter("@ServerIntegerOut", adInteger, adParamOutput)
End With
'The code below can be repeated any number of times
YourCommand("@ServerVarCharIn"

= "Hello"
YourCommand("@ServerIntegerIn"

= 42
YourCommand.Execute
Msgbox "The Stored Procedure returned " & Cstr(YourCommand("@ServerIntegerOut"

)
----------------------------------------
Even though it can be tempting to return values in a recordset(because of the much shorter syntax), it is much faster to return values in output parameters with the Command Object. So, if you are only returning a few values: use the Command Object.
Sunaj
'The gap between theory and practice is not as wide in theory as it is in practice'