Hello all,
I know this is a very common question but I can't really find the right solution for this error. I wanted to create a login form where authorized user will be redirected to authorized page. I'm using MySQL database. I'm really new with both asp.net and MySQL.
Private Sub btLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btLogin.Click
Dim strCon = ("DRIVER={MySQL ODBC 3.51 Driver};server=localhost; uid=root; password=kucemari; database=plantsnherbs")
Dim objcon As New OdbcConnection(strCon)
Dim objCommand As New OdbcCommand("SELCET adminid FROM admin WHERE adminid = @adminid AND password = @password ", objcon)
objCommand.Parameters.Add("@adminid", OdbcType.TinyInt).Value = Me.tbadminid.Text
objCommand.Parameters.Add("@password", OdbcType.VarChar).Value = Me.tbpassword.Text
objcon.Open()
If tbadminid.Text = "@adminid" And tbpassword.Text = "@password" Then --> I'm stuck with this!
Response.Cookies("FirstName").Value = tbadminid.Text
Response.Redirect("http://localhost/plantsnherbs/adminpage.aspx")
Else
Response.Write("Login failed. Please enter correct Admin ID and password")
End If
objcon.Close()
End Sub
No one has replied yet! Why not be the first?
Sign in or Join us (it's free).