protected void btn_update_Click(object sender, EventArgs e) { AdminTableAdapter ta_admin = new AdminTableAdapter(); DataTable dt_admin = ta_admin.GetAdminByName(txt_name.Text); if (dt_admin.Rows.Count <= 0) { lab_tip.Text = "不存在的管理员帐户"; } else { int id = Convert.ToInt32(ta_admin.GetAdminByName(txt_name.Text).Rows[0]["id"]); int type = Convert.ToInt32(ta_admin.GetAdminByName(txt_name.Text).Rows[0]["type"]); ta_admin.UpdateAdmin(txt_name.Text, txt_psw.Text, type, id); lab_tip.Text = "修改密码成功<script>alert('修改密码成功');</script>"; } }