改密码sql
1. dal cardinfo changePwdthis
public bool changePwd(string CardID, string oldPwd, string newPwd)事件
{ip
string sql = "update cardinfo set pass='"+ newPwd + "' where cardID='" + CardID + "' and pass='"+oldPwd+ "' and IsReportLoss=0";string
int n = DbHelperSQL.ExecuteSql(sql);登录
if (n >= 1)object
{date
return true;密码
}di
else
{ return false; }
}
2. bll- cardinfo changePwd
public bool changePwd(string CardID, string oldPwd, string newPwd)
{
return dal.changePwd(CardID, oldPwd,newPwd);
}
3. winf- ChangePWD
!)增长卡号字段
public string CardID;
2)编写按钮点击事件
private void button1_Click(object sender, EventArgs e)
{
label4.Text = "";
if (textBox2.Text != textBox3.Text)
{ label4.Text = "两次新密码不一致,请重输!"; }
else
{
BLL.cardinfo bll = new BLL.cardinfo();
bool isOK= bll.changePwd(CardID, textBox1.Text, textBox3.Text);
if (isOK) {
MessageBox.Show("密码修改为功,请从新登陆!","成功");
this.DialogResult = DialogResult.OK;
}
else { label4.Text = "密码修改失败,请重试!"; }
}
}
4. winf-main-菜单
private void 改密码ToolStripMenuItem_Click(object sender, EventArgs e)
{
ChangePWD cp = new ChangePWD();
cp.CardID = CardID;
DialogResult OK=cp.ShowDialog();
if (OK == DialogResult.OK) {
退出帐户toolStripMenuItem_Click(null, null);
}
}