text1为原密码。text2为新密码,text3为确认密码
Dim mrc As ADODB.Recordset
Dim MsgText As String
Dim txtSQL As String
Private Sub Command1_Click()
If Trim(Text1.Text) = "" Then
MsgBox "原不能为空", vbOKOnly, "信息提示"
Text1.SetFocus
Exit Sub
End If
If Trim(Text2.Text) = "" Then
MsgBox "新密码不能为空", vbOKOnly, "信息提示"
Text1.SetFocus
Exit Sub
End If
If Trim(Text2.Text) <> Trim(Text3.Text) Then
MsgBox "密码与原密码一致,请重填!", vbOKOnly, "信息提示"
Text2.SetFocus
Text1.Text = ""
Text2.Text = ""
Exit Sub
End If
txtSQL = "select 口令 from oper where 用户名='" & UserName & "' "
Set mrc = ExecuteSQL(txtSQL, MsgText)
If Trim(mrc.Fields("口令")) <> Trim(Text1.Text) Then
MsgBox "用户原密码输入错误!", vbOKOnly, "警告"
Text1.Text = ""
Text1.SetFocus
Text2.Text = ""
Text3.Text = ""
Else
txtSQL = "update oper set 口令 ='" & Text2.Text & "'where 用户名='" & UserName & "' "
MsgBox "该用户密码修改成功!", vbOKOnly, "信息提示"
End If
Unload Me
End Sub
运行时出现
请高手帮忙,谢谢