468,470 Members | 2,147 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,470 developers. It's quick & easy.

Output parameter read from stored procedure empty

I'm using a stored procedure from an ASP page using a ADODB connection, the sproc returns a value and also has an output parameter.
Both are being read in the page but they are both empty, I profiled the sproc call and tested it directly and the values are being returned correctly.

What could the problem be? quick note: in another server the same code works fine.

The code I'm using to get the values looks like (just the relevant part where parameters are set then when reading the values).

Expand|Select|Wrap|Line Numbers
  1. '... objects are declared, etc. command name is adoCommand
  2. '... objects are initialized (connetions strings, etc), and command type is adCmdStoredProc
  3. '... sproc parameters are created.
  4. adoParams.Append adoCommand.CreateParameter("@RETURN_VALUE", adInteger, adParamReturnValue, 4)
  5. adoParams.Append adoCommand.CreateParameter("@id", adInteger, adParamOutput, 4)
  6. adoParams.Append adoCommand.CreateParameter("@name", adVarchar, adParamInput, 100, Left(Name, 100))
  8. adoCommand.Execute
  10. '... next statement is alway true even when the return value (when tested directly in SQL) is 1
  11. If adoParams.Item("@RETURN_VALUE").Value <> 1 Then
  12.   ' some code here
  13. End If
  15. '... next statement always return nothing even when the output parameter has a value (again, tested directly in sql)
  16. clientId = adoParams.Item("@id").Value
Apr 6 '11 #1
0 1459

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Dave McKie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.