protected void Button2_Click(object sender, EventArgs e) { LoginAdmin_attripute login = new LoginAdmin_attripute { Quation = txtQuation.Text, Answer = txtAnswer.Text, Password = txtPass.Text, UserName = txtUser.Text }; int x = LoginAdmin.Update(login, 1); if (x == 1) { Response.Redirect("LoginToShowAdmin.aspx"); } }
protected void Button1_Click(object sender, EventArgs e) { DataTable data = LoginAdmin.SelectById(1); LoginAdmin_attripute login = new LoginAdmin_attripute { Answer = txtAnswer.Text, Password = txtNewPass.Text, Quation = txtQuation.Text, UserName = txtUser.Text }; if (txtOldPass.Text == data.Rows[0]["Password"].ToString()) { int x = LoginAdmin.Update(login, 1); if (x == 1) { Response.Redirect("ShowAdmin.aspx"); } } else { lblError.Text = "Error old password"; } }
public static int Update(LoginAdmin_attripute L, int id) { string state = $"Update LoginAdmin set User_Name = '{L.UserName}', Password = '******', Quation = '{L.Quation}', Answer = '{L.Answer}' where Id_Login_Admin = {id}"; return(Connection.ExecuteNonQuery(state)); }