我们在登陆一些没保存密码的账号的时候都出现过这种情况
请输入密码
“wozhenyouxiu”(因为密码都是星号所以我们并不知道我们是否真的输对了)
密码错误请重新输入
“wozhenyouxiu”
密码错误请重新输入
“修改密码!”
请输入新密码
“wozhenyouxiu”
新旧密码不能相同
这时候我真的恨不得把电脑砸了,但这种设定在我们编程的时候是应该有的,那我们在修改密码窗体的时候就应该多了一些步骤,接下来就是我的代码
Private Sub cmdOk_Click()
strSQL_user = "select * from user_info where pwd='" & Trim(OldPassword.Text) & "'"
Set mrc_user = ExecuteSQL(strSQL_user, MsgString)
If Trim(OldPassword.Text) = "" Then
MsgBox "请输入原密码进行验证", , "提示"
OldPassword.SetFocus
Exit Sub
End If
If Trim(NewPassword0.Text) = "" Then
MsgBox "请输入修改后的密码", , "提示"
Password.SetFocus
Exit Sub
End If
If Trim(NewPassword1.Text) = "" Then
MsgBox "请确认密码", , "提示"
txtmiok.SetFocus
Exit Sub
End If
'原密码一致
If mrc_user.EOF Then
MsgBox "原密码验证失败", , "提示"
OldPassword.Text = ""
OldPassword.SetFocus
Exit Sub
End If
'验证新密码与原密码一致
If Trim(NewPassword0.Text) = Trim(OldPassword.Text) Then
MsgBox "新旧密码不能相同", , "提示"
NewPassword0.Text = ""
NewPassword1.Text = ""
NewPassword0.SetFocus
Exit Sub
End If
'确认密码
If Trim(NewPassword1.Text) <> Trim(NewPassword0.Text) Then
MsgBox "两次密码输入不一致", , "提示"
NewPassword0.Text = ""
NewPassword1.Text = ""
txtmi.SetFocus
Else
mrc_user.Fields(1) = Trim(NewPassword1.Text)
mrc_user.Update
MsgBox "修改成功", , "提示"
OldPassword.Text = ""
NewPassword0.Text = ""
NewPassword1.Text = ""
End If
End Sub