Torna al Thread

[CODE] Imports System Imports System.Data Imports System.Data.Odbc Partial Class members_login Inherits System.Web.UI.Page Protected Sub btnLogin_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnLogin.Click Dim strConn As String = "DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;DATABASE=db1;UID=root;PASSWORD=root;OPTION=3" Dim conn As OdbcConnection = New OdbcConnection(strConn) conn.Open() Dim Sql As String = "SELECT * FROM users WHERE user_email = '" & txtEmail.Text & "' and user_password='" & txtPassword.Text & "'" Dim MyCommand As OdbcCommand = New OdbcCommand(Sql, conn) Dim ObjDataReader As OdbcDataReader ObjDataReader = MyCommand.ExecuteReader(CommandBehavior.CloseConnection) If (ObjDataReader.Read()) Then If (txtEmail.Text = ObjDataReader("user_email").ToString()) Then Else Response.Write("Non email trovata") End If If (txtPassword.Text = ObjDataReader("user_password").ToString()) Then Else Response.Write("Non email trovata") End If Else Dim email As String = ":" + ObjDataReader("user_ruolo") FormsAuthentication.RedirectFromLoginPage(email, False) End If conn.Close() End Sub End Class [/CODE]
Copyright © dotNetHell.it 2002-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5