ADO output Parameter help.

G

Guest

I am using ado 2.6 in ac97. The code below gave me the return values in my
two output paramenters under debug view, but the values did not get assign
into the variables( intRetCode & strRetMes). What went wrong?

Thanks!

Dim intRetCode As Integer
Dim strRetMes As String
.....
With cmd
Set .ActiveConnection = cn
.CommandType = adCmdStoredProc
.CommandText = "OP_checkValidDiscounts"
.Parameters.Append cmd.CreateParameter("@CO_Number",
adVarChar, adParamInput, 15, rsTmp!head_order_nbr)
.Parameters.Append cmd.CreateParameter("@RetCode",
adInteger, adParamOutput, 15, intRetCode)
.Parameters.Append cmd.CreateParameter("@RetMsg", adVarChar,
adParamOutput, 100, strRetMes)
.Execute

End With
 
G

Guest

homer,

If you read the values of the parameters after the command execution then
you will get the values you need:

With cmd
...
.Execute
ntRetCode = .Parameters("@RetCode").Value
ntRetMsg = .Parameters("@RetMsg").Value
End With

Unlike the default behaviour for A97 the variables that you have used to
create parameters are not sent by reference - they are passed ByVal - that is
the reason that they are not receiving the returned values after the command
execution.

HTH.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top