Kevin, you were correct originally, this is a stored procedure.
It does not use an output parameter.
However, I noticed in the information link that you provided regarding using a UDF with ADO.NET that they:
1. Declared a ReturnValue variable as SqlParameter
2. Set the ReturnValue.Direction = ParameterDirection.ReturnValue
3. Used cmd.ExecuteNonQuery to execute the UDF
My breakdown in understanding seems to center on the requirement/usage of an output parameter.
Do I need to use an output parameter?
How would I change the following code to correctly use an output parameter and thus correctly return the value of the stored procedure?
Public Function GetBatchAlreadyProcessed(ByVal batchID As Integer) As String
Dim dao As mmDataAccessBase = Me.GetDataAccessObject
Dim BatchIdParam As IDbDataParameter = dao.CreateParameter("@BatchId", batchID)
BatchIdParam.Direction = ParameterDirection.Input
Return CStr(Me.ExecSprocScalar("tsgsp_GetBatchAlreadyProcessedTF", BatchIdParam))
End Function
CREATE FUNCTION tsgsp_GetBatchAlreadyProcessedTF (@BatchId int) RETURNS CHAR(5)
AS
BEGIN
DECLARE @BatchProcessedTF AS CHAR(5)
SELECT @BatchProcessedTF =
CASE
WHEN COUNT(DISTINCT BatchId) = 1 THEN 'True'
ELSE 'False'
END
FROM ParticipantCheckDetail
WHERE BatchID = @BatchId
RETURN @BatchProcessedTF
END
GO
THANKS for your patient understanding and assistance!
THANKS
Joe Salvatore, Programmer/Analyst - The Stellar Group