I have the following sp that doesne't seem to output anything.
If I run the select on its own, it returns data, but when I run the sp, the sp does not return 0 or 1.
Also,
How do I get that returned value using ADO?
I tried:
Code:
ALTER PROCEDURE dbo.spKitsWithSubOrders
(@lngWOID int, @lngWOIDSub smallint, @bResult bit OUTPUT)
AS
SET @bResult = 0
IF EXISTS
(
SELECT dbo.T_SetupSheetHistoryCombinationsDetail.WOID, dbo.T_SetupSheetHistoryCombinationsDetail.WOIDSub
FROM dbo.T_SetupSheetHistoryCombinationsDetail INNER JOIN
dbo.T_SetupSheetKitMaster ON
dbo.T_SetupSheetHistoryCombinationsDetail.ComboCustPartNum = dbo.T_SetupSheetKitMaster.KitItemPartNum
)
SET @bResult = 1
RETURN
If I run the select on its own, it returns data, but when I run the sp, the sp does not return 0 or 1.
Also,
How do I get that returned value using ADO?
I tried:
Code:
Dim cmd As ADODB.Command
Dim prm As ADODB.Parameter
Dim rs As ADODB.Recordset
Dim lngWOID As Long
Dim lngWOIDSub As Long
Dim bOutput As Boolean
Set cmd = New ADODB.Command
Set rs = New ADODB.Recordset
lngWOID = 100030
lngWOIDSub = 0
With cmd
.ActiveConnection = CurrentProject.Connection
.CommandText = "spKitsWithSubOrders"
.CommandType = adCmdStoredProc
End With
Set prm = cmd.CreateParameter("@lngWOID", adInteger, adParamInput, , lngWOID)
cmd.Parameters.Append prm
Set prm = cmd.CreateParameter("@lngWOIDSub", adInteger, adParamInput, , lngWOIDSub)
cmd.Parameters.Append prm
Set prm = cmd.CreateParameter("@bResult", adBoolean, adParamOutput, , bOutput)
cmd.Parameters.Append prm
Set rs = cmd.Execute
'::: Now use value of bOutput for results
MsgBox "The returned value is: " & rs.Fields(0)