Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Login stored procedure

Author  Topic 

Mpilo
Yak Posting Veteran

52 Posts

Posted - 2008-09-25 : 06:17:36
Hi
i am looking for a stored procedure for login using two tables,using the USER table and MEMBER table.could you plz give the structure for creating a procedure
the
columns for User table are
Username
Passwword
the columns for member table are
MembershipNum
Surname

i want a stored procedure that will use membershipnum as a password.the surname will be used as the UserName

many thanks

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-09-25 : 06:29:26
[code]CREATE PROC GetLoginDetails
@userName varchar(100)
AS

SELECT UserName,Password
FROM
(SELECT Username AS UserName,Password AS Password
FROM User
UNION ALL
SELECT SurName,MembershipNum
FROM Member
)t
WHERE UserName=@UserName
GO[/code]
Go to Top of Page

Mpilo
Yak Posting Veteran

52 Posts

Posted - 2008-09-25 : 07:05:19
can you plz give another example of a stored procedure for login using the data i provided earlier but a different format the procedure runs successfully but not when
create login from my website.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-09-25 : 07:07:37
quote:
Originally posted by Mpilo

can you plz give another example of a stored procedure for login using the data i provided earlier but a different format the procedure runs successfully but not when
create login from my website.


what do you mean by that? what are you passing from website?
Go to Top of Page

Mpilo
Yak Posting Veteran

52 Posts

Posted - 2008-09-25 : 07:19:08
i want a stored procedure that will use membershipnum as a password.the surname will be used as the UserName

what i mean is that when we create the user login ,the username and the password must be created using the membershipnum and surname.


quote:
Originally posted by visakh16

quote:
Originally posted by Mpilo

can you plz give another example of a stored procedure for login using the data i provided earlier but a different format the procedure runs successfully but not when
create login from my website.


what do you mean by that? what are you passing from website?

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-09-25 : 07:23:20
what all values will be passed to stored procedure from front end?
Go to Top of Page

Mpilo
Yak Posting Veteran

52 Posts

Posted - 2008-09-25 : 07:35:29
Thanks it works..
quote:
Originally posted by visakh16

CREATE PROC GetLoginDetails
@userName varchar(100)
AS

SELECT UserName,Password
FROM
(SELECT Username AS UserName,Password AS Password
FROM User
UNION ALL
SELECT SurName,MembershipNum
FROM Member
)t
WHERE UserName=@UserName
GO


Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2008-09-25 : 11:32:31
If you are using Microsoft memeberhip provider, the above will not work.

You have to use the microsoft memberhsip provider and web.config file to configure your security options.

With c# you dont have to build such complex codes, authentication is done by

}
if (Membership.ValidateUser(Login1.Username,Login1.Password)
{
e.Authenitcated = true;
}
else
{
e.Authenticated = false;
}
}


And you dont need a SP to create users, its done with one line of code

Memebrship.Createuser("mpilo","afrika","mpilo@sqlteam.com");


And the good thing, passwords are encrypted for you, making life a lot easier.

read up on
1. Roles
2. Authentication
3. Authorization

Using Microsoft memebrship provider
Go to Top of Page
   

- Advertisement -