protected void Button1_Click(object sender, EventArgs e) { SqlConnection conn = new SqlConnection("Data Source=localhost\\SqlExpress;Initial Catalog=dad1;Integrated Security=True"); string pass = "pppp", rol = "rrrr", sql; sql = "SELECT * FROM UserName where Name ='" + TextBox1.Text + "' "; SqlCommand comm = new SqlCommand(sql, conn); conn.Open(); SqlDataReader reader = comm.ExecuteReader(); \\ this is problem if (reader.Read()) { pass = (string)reader["password"]; rol = (string)reader["role"]; } else { Label1.Text = "no user found "; } reader.Close(); conn.Close(); if (TextBox2.Text == pass) { Session["Authencated"] = rol; if (rol == "Admin") Server.Transfer("Default2.aspx"); else Server.Transfer("Default3.aspx"); } else Label1.Text = "wrong password"; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)