我有一个包含 4 列的网格视图(用户 ID、描述、密码、更改密码 [按钮])。
当我单击更改密码时,会出现带有 3 个文本框(用户 ID、新密码、确认密码)的面板并显示保存按钮。
更改密码后,面板消失,但网格视图中的密码与以前相同。
我想更新密码列。
以下是我的保存按钮点击
代码
protected void BindGridView()
{
try
{
DataTable dt = new DataTable();
dt = (DataTable)Session["userinfo"];
gvPassInfo.DataSource = dt;
gvPassInfo.DataBind();
}
catch (Exception ex)
{
//lblMessage.Text = DataObjects.Error_Message();
}
}
protected void btnSave_Click(object sender, EventArgs e)
{
clsUser objuser = new clsUser();
string user = txtUserid.Text;
string NewPassword = txtNewPassword.Text;
string ConfirmPassword = txtConfirmNewPassword.Text;
objuser.UpdateSystemPassword(user, NewPassword);
Response.Write("<script LANGUAGE='JavaScript' >alert('Password Changed Successfully...'); document.location='" +ResolveClientUrl("~\\PasswordInformation_Details.aspx") + "'; </script>");
BindGridView();
panelChangePassword.Visible = false;
}
protected void btnSearch1_Click(object sender, EventArgs e)
{
try
{
using (MySqlConnection conn = new MySqlConnection(clsUser.connStr))
{
conn.Open();
string strQuery = "select DISTINCT user_id,description,sap_system_password from sap_password_info where user_id is not null";
if (txtSid.Text !="")
{
strQuery += " AND sid = '" + txtSid.Text + "'";
}
if (txtClient.Text != "")
{
strQuery += " AND client_no = '" + txtClient.Text + "'";
}
if (txtUser.Text != "")
{
strQuery += " AND user_id = '" + txtUser.Text + "'";
}
MySqlCommand cmd = new MySqlCommand(strQuery, conn);
DataTable dt = new DataTable();
dt.Load(cmd.ExecuteReader(CommandBehavior.CloseConnection));
Session["userinfo"] = dt;
Response.Redirect("~\\PasswordInformation_Details.aspx");
}
}
catch (Exception ex)
{
//lblMessage.Text = DataObjects.Error_Message();
lblMsg.Text = ex.Message.ToString();
}
}
代码在 C# 中,后端是 MySQL DB Server.. 请帮助..