Question

  Asked: Feb 21 2008   1:36 AM GMT
  Asked by: Blue


Membership login with mysql


ASP.NET, MySQL, C

hi, i doing a login program which will be using mysql. I would like to how do i do that, I have done a little but i am stuck half way can anyone help?
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
{
MySqlConnection conDatabase = new MySqlConnection("Server=localhost;Persist Security Info=no;User ID=Administrator");
MySqlConnection cnnVideos = new MySqlConnection("Network Address=localhost;" +
"Initial Catalog='login';" +
"Persist Security Info=no;" +
"User Name='root';" +
"Password=''");

}

Subscribe to Alerts! Get questions and answers delivered to your Inbox.


E-mail me updates on this question



   SUBSCRIBE

hidden modal window

Answer Wiki (Improve, edit or add to this answer)


 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0



Create a stored procedure in the MySQL database (if you have a version which supports procedures) which has input parameters for the username and password. Pass it the username and password and within the procedure have it check a table and see if the username and password exist in a single row. Something like this.

CREATE PROCEDURE MyProcedure
@UserName nvarchar(50),
@Password nvarchar(50)
AS
SELECT 1
FROM YourTable
WHERE UserName = @UserName
and Password = @Password
GO


Then if there is no record it's not a valid account. If there is a record it is a valid account.

This page has come good info about using stored procedures.
  • AddThis Social Bookmark Button

Browse more Questions and Answers on Development and Database.

Looking for relevant Development Whitepapers? Visit the SearchSQLServer.com Research Library.


Discuss This Answer


You must be logged-in to discuss a question. Log-in/Register