Hi,
How to make a login form in Asp.net using mysql server ?
can give you an example ?
Thanks
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Satyapriya NayakRank #47 · 31.5K reputationPosted Dec 23, 2011, 11:15 PM EST
Try this...
' Import the ODBC namespace for MySQL Connection
Imports System.Data.Odbc
Partial Class login
Inherits System.Web.UI.Page
Protected Sub Login1_Authenticate(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.AuthenticateEventArgs) Handles Login1.Authenticate
Dim cn As New OdbcConnection("Driver={MySQL ODBC 3.51 Driver};Server=localhost;Database=mydb; User=root;Password=;")
cn.Open()
Dim cmd As New OdbcCommand("Select * from login where username=? and password=?", cn)
'Add parameters to get the username and password
cmd.Parameters.Add("@username", OdbcType.VarChar)
cmd.Parameters("@username").Value = Me.Login1.UserName
cmd.Parameters.Add("@password", OdbcType.VarChar)
cmd.Parameters("@password").Value = Me.Login1.Password
Dim dr As OdbcDataReader
' Initialise a reader to read the rows from the login table.
' If row exists, the login is successful
dr = cmd.ExecuteReader
If dr.HasRows Then
e.Authenticated = True
' Event Authenticate is true
End If
End Sub
End Class
Refer the below link for more
http://dotnet.tekyt.info/?p=31
http://www.codeguru.com/csharp/.net/net_data/article.php/c19493
Thanks
Prabhu RajaRank #861 · 2.6K reputationPosted Dec 24, 2011, 12:01 AM EST
You can Download a Sample Source Code Here and follow the instructions,
http://forum.coolwebawards.com/threads/10-ASP.NET-forms-authentication-login-using-C-.NET
AartiRank #2,383 · 594 reputationPosted Dec 25, 2011, 9:22 PM EST
refer this link step by step to create login form
http://dotnet.tekyt.info/?p=31