HalfADimePlural
7 years agoNew Contributor
Get return value from a stored procedure
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" Call sproc.Parameters.AddParameter() 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 Call sproc.ExecProc() 'this always ends up being zero labelNum = sproc.Parameters.Items(0).Value