protected void Page_Load(object sender, EventArgs e) { if (Session["UserType"] == null || Convert.ToInt32(Session["UserType"]) != Global.AdminUserType) //admin { Global.Application_AccessDenied(sender, e); } else { SqlDataSource1.ConnectionString = Global.getConnectionString(); } IndustryName.Focus(); }
public void Update() { string strsql = "update Industry set " + "IndustryName= '" + IndustryName.Replace("'", "''") + "', " + "Status= '" + Status.Replace("'", "''") + "' " + " where ID =" + Id; SqlConnection ObjConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["MyJobPortal"].ConnectionString); ObjConnection.Open(); SqlCommand ObjCommand = new SqlCommand(strsql, ObjConnection); ObjCommand.ExecuteNonQuery(); ObjConnection.Dispose(); ObjCommand.Dispose(); }