lundi 20 mai 2019

If Admin.isvalid then it enables the admin roles in next page if user.isvalid then it give the user roles in next page asp.net

When user logged in then it checks either if it is admin or user then it enables the controls accordingly in next page in asp.net c#

SqlConnection con = new SqlConnection(connectionstring);

SqlCommand cmd = new SqlCommand("SELECT * FROM Users Where Name ='" txtusername.Text + "' AND Password='" + txtpassword.Text + "'", con);

con.Open();

    SqlDataReader sdr = cmd.ExecuteReader();
      if (sdr.Read() == true)
    {
        try
           bool Admin = Convert.ToBoolean(sdr["Admin"]);
            isadmin = Admin;
            Response.Redirect("InserRecord.aspx");
        }




Aucun commentaire:

Enregistrer un commentaire