I have this code
' Insert item into database
With cmd
.ActiveConnection = conn
.CommandText = "exec myschema.usp_procedure" _
& "'" & user & "'," _
& "''" ' output id
.CommandType = adCmdText
.CommandTimeout = 300
.Execute
Dim outputId As Integer
outputId = cmd.Parameters("outputId").Value
End With
I am getting error
Item cannot be found in the collection corresponding to the requested name or ordinal
Whats wrong ? How can i retrieve the @outputId int OUTPUT
parameter ?
- The stored procedure is executed properly, i can see new items in database
another try
Dim outputId As Integer
With cmd
.ActiveConnection = conn
.CommandText = "exec edi.usp_ImportOrderHeader" _
& "'" & user & "'," _
& "''"
.Parameters.Append .CreateParameter("outputId", adNumeric, adParamOutput, , outputId)
.CommandType = adCmdText
.CommandTimeout = 300
.Execute
End With
store procedure execute without error, but outputId is zero :/