/*
Hi there.
*/

ALTER PROCEDURE [dbo].[auth]
-- Add the parameters for the stored procedure here
-- *** "output"s removed ***
-- *** varchar --> varchar(100) to finish their declaration ***
-- *** only assumed 100 ... match your table parameters ***
(
@user varchar(100),
@password varchar(100)
)

AS

DECLARE
-- *** @id int, @pos varchar *** Not needed or being used ***

BEGIN
SET NOCOUNT ON;

-- Insert statements for procedure here
-- **
SELECT PersonID, Rank, Position, Supervisor FROM PERSON
        WHERE UserName = @user AND Password = @password;

SET NOCOUNT OFF; -- *** switch it back before end ***
END



/* -----
If it were me, I would use the procedure above.

Call it into a SqlDataReader.
Place a counter=0 just outside the loop you will use
to loop through the 1 record. Also, counter += 1 in
that loop.

if (counter == 1) // login successful
{
        //successful login code
}
else //counter still 0, no record returned
{
        //login unsuccessful code
}
-----
*/


Reply via email to