密码修改怎么写?
string oldpass = “登陆用的旧密码”;
if (textbox1.Text == oldpass)
{
string newpass = textbox2.Text;
string sql = “update 用户登录表 set 密码字段=’” + newpass + “’ where 用户名字段=登陆的用户”;
SqlConnection conn = new SqlConnection(“连接数据库字符串”);
conn.Open();
SqlCommand cmd = new SqlCommand(sql, conn);
cmd.ExecuteNonQuery();
conn.Close();
//提示修改成功
}
else
{
//提示,旧密码不正确
}