I followed the documentation on stored procedures here and I'm able to get my stored procedure to run, but my return value is always 0. I've searched high and low for my problem but no one else seems to be having it.
Set sproc = ADO.CreateADOStoredProc
sproc.ConnectionString = Project.Variables.ConnStringDB02
sproc.ProcedureName = WMSLib.useDB & ".dbo.get_TestLabel"
sproc.Parameters.Items(0).Name = "RETURN_VALUE"
sproc.Parameters.Items(0).DataType = adInteger
sproc.Parameters.Items(0).Direction = adParamReturnValue
sproc.Parameters.Items(0).Value = Null
'this always ends up being zero
labelNum = sproc.Parameters.Items(0).Value
What does you SP look like. Your sp may actually be returning the result of 0. It could be because you don't have nocount on or the like. If you do, the sp returns two "datasets" and ADO picks up the first one which is just your result
Edit: If this is the case, there are two options off the top of my head:
1. Add SET NOCOUNT ON and off to the SP
2. Allocate the output to a new recordset using sproc.NextRecordset() and use this for your checks/lookups etc.
------------------------------------------------- Standard syntax disclaimers apply Regards,
I'm not the one who made the stored procedure and I don't have enough experience with them to be sure how it was setup. How would I access the second dataset to get the value I'm looking for? Editing the sproc is not an option.