c#编程修改密码的代码

2022-07-13 23:14:19   第一文档网     [ 字体: ] [ 阅读: ] [ 文档下载 ]
说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。下载word有问题请添加QQ:admin处理,感谢您的支持与谅解。点击这里给我发消息

#第一文档网# 导语】以下是®第一文档网的小编为您整理的《c#编程修改密码的代码》,欢迎阅读!
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 (this.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(object 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("修改失败!","系统提示"); } }

}


本文来源:https://www.dywdw.cn/c4692fedf8c75fbfc77db27c.html

相关推荐
推荐阅读