《c#编程修改密码的代码.docx》由会员分享,可在线阅读,更多相关《c#编程修改密码的代码.docx(2页珍藏版)》请在三一办公上搜索。
1、c#编程修改密码的代码C#修改密码的代码 public FrmXiuGaiMiMa InitializeComponent; private bool JudgeNewPwd string newPwd1 = this.txtNewPwd1.Text; string newPwd2 = this.txtNewPwd2.Text; if (newPwd1.Equals(newPwd2) return true; else MessageBox.Show(两次输入的新密码不相等,请重新输入!,系统提示); return false; private bool Confirmation if (th
2、is.txtName.Text != string.Empty & this.txtOldPwd.Text != string.Empty&this .txtNewPwd1 .Text !=string .Empty &this .txtNewPwd2 .Text !=string .Empty ) return true; else MessageBox.Show(用户名和密码不能为空!, 系统提示); return false; private void Form4_Load(object sender, EventArgs e) private void button2_Click(ob
3、ject sender, EventArgs e) this.Close; private void button1_Click(object sender, EventArgs e) if (Confirmation) if (JudgeNewPwd) string oldPwd = this.txtOldPwd.Text; string uname = this.txtName.Text; string newPwd1 = this.txtNewPwd1.Text.ToString ; string sql = string.Format(update _UserInfo set UPassWord=0 where UPassWord=1 and UName=2,newPwd1 ,oldPwd ,uname ); if (DataAccess.UpdataDataTable(sql) MessageBox.Show(修改成功!, 系统提示); else MessageBox.Show(修改失败!,系统提示);