Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
GetExecScalar Returns Nothing
Message
De
22/10/2004 15:28:29
 
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
00953138
Message ID:
00953848
Vues:
16
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform