views:

23

answers:

0

My sproc signature is defined as:

ALTER PROCEDURE [dbo].[AuthenticateUser] 
    -- Add the parameters for the stored procedure here
    @UserName varchar(64), 
    @UserPassword varchar(64),
    @Result INT OUT,
    @ErrorMessage VARCHAR(25) OUT
AS
BEGIN....

Calling this sproc with SubSonic:

DataSet dsResults = new DataSet();

StoredProcedure sp = SPs.AuthenticateUser(userName, password, intResGetUserDetails, ErrorMessage);
sp.GetDataSet();

intResGetUserDetails = (int)sp.OutputValues[0];
ErrorMessage = (string)sp.OutputValues[1];

First of all, why is it necessary to add output parameters in the .AuthenticateUser call (intResGetUserDetails, ErrorMessage), instead of just calling userName and password, then accessing the output parameters with sp.OutputValues?

Secondly, is it possible to access the output values by name, ie. .OutputValues("Result") ?

Thank you.