我必须写一个代码来更改密码
if (txtNewPassword.Text == txtConfirmPassword.Text)
{
mSQL = "SELECT * FROM User WHERE userName = '" + txtUserName.Text + "' AND password = '" + txtPassword.Text + "'";
mDT_Save = mDBHelper.GetTable(mSQL);
if (mDT_Save.Rows.Count > 0)
{
for (int i = 0; i < mDT_Save.Rows.Count; i++)
{
mSQL = "UPDATE User SET password = '" + txtConfirmPassword.Text + "' WHERE userName = '" + Convert.ToString(mDT_Save.Rows[i]["userName"]) + "'";
mDBHelper.ExecuteSQLNonQuery(mSQL);
}
MessageBox.Show("Password Changed Successfully");
txtPassword.Text = txtConfirmPassword.Text;
return;
}
else
{
MessageBox.Show("User Not Found");
return;
}
}
通过这种方式,用户可以随时更改密码,但我希望用户每天只能更改一次密码。这个条件怎么写?
波斯汪
慕勒3428872
相关分类