HalfADimePlural
6 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
VERY old post, but the principals are still the same
Multiple Recordset Stored Procedure
Specifically:
In ADO however when return multiple recordsets you loop through the
recordet something like this
SET Rst = Connection.Execute(procMultipleRst)
doWhatever1 Rst
SET Rst = Rst.NextRecordset
doWhatever2 Rst
SET Rst = Rst.NextRecordset
doWhatever3 Rst