public bool Login() { SqlConnection con = new SqlConnection(this.ConnectDB()); SqlCommand cmd = new SqlCommand(); SqlDataReader rdr = default(SqlDataReader); { cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "sp_Login"; cmd.Parameters.AddWithValue("@Password", Password); cmd.Parameters.AddWithValue("@Username", Username); cmd.Connection = con; } bool userfound = false; try { con.Open(); rdr = cmd.ExecuteReader(); if (rdr.Read()) { userfound = true; this.Role = rdr("Role"); } } catch (Exception ex) { msg = "Invalid Username or Password" + ex.Message.ToString(); } finally { con.Close(); } return userfound; }
LoginButon_Click
Session("Role") = objlogin.Role;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)