By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,867 Members | 1,964 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,867 IT Pros & Developers. It's quick & easy.

Output parameter read from stored procedure empty

vavc1980
P: 25
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))
  7.  
  8. adoCommand.Execute
  9.  
  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
  14.  
  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
  17.  
  18.  
Apr 6 '11 #1
Share this question for a faster answer!
Share on Google+

Post your reply

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