What I would like to do is use my spLogin
stored procedure to return two values from the same table, both of which I would like to save in sessions in C#.
Here is the table
create table tbClients
(
ClientID int primary key identity(0,1),
ClientFirstName varchar(20),
ClientLastName varchar(20),
ClientAddress varchar(60),
ClientOrigin varchar(20),
ClientUsername varchar(20),
ClientPassword int,
ClientSecurity int
)
When the client clicks the login button I want to code a procedure that will check to see if the user is valid, what their security level is, and that their first name is.
Here is what I have so far
create procedure spLogin(
@ClientUsername varchar(20),
@ClientPassword int
)
AS BEGIN
DECLARE @Security int
DECLARE @ClientFirstName varchar(20)
IF EXISTS (SELECT * FROM tbClients
WHERE ClientUsername = @ClientUsername
AND ClientPassword = @ClientPassword)
BEGIN
SELECT
@Security = ClientSecurity,
@ClientFirstName = ClientFirstName
FROM tbClients
WHERE
ClientUsername = @ClientUsername
AND ClientPassword = @ClientPassword
IF(@Security = 1)
BEGIN
SELECT 'Admin' as Security, @ClientFirstName
END
ELSE
BEGIN
SELECT 'Customer' as Security, @ClientFirstName
END
END
ELSE
BEGIN
SELECT 'INVALID'
END
END
GO
Don't know if this will work because I am not sure how to store these values in C# without using a dataset, which doesn't seem to be working so far?