I'm trying to create a login aspx page.
What am I doing wrong here?
MySqlConnection cn = new MySqlConnection("Server=localhost;Database=securitytest; User=root;Password=sx;");
cn.Open();
MySqlCommand cmd = new MySqlCommand("Select * from login where username=@username and password=@password", cn);
//Add parameters to get the username and password
cmd.Parameters.Add("@username", OdbcType.VarChar);
cmd.Parameters["@username"].Value = this.Login1.UserName;
cmd.Parameters.Add("@password", OdbcType.VarChar);
cmd.Parameters["@password"].Value = this.Login1.Password;
MySqlDataReader dr = default(MySqlDataReader);
// Initialise a reader to read the rows from the login table.
// If row exists, the login is successful
dr = cmd.ExecuteReader();
if (dr.HasRows)
{
e.Authenticated = true;
// Event Authenticate is true
}