📄 setpassword.frm
字号:
VERSION 5.00
Begin VB.Form SetPassword
BorderStyle = 1 'Fixed Single
Caption = "密码设置"
ClientHeight = 3150
ClientLeft = 45
ClientTop = 330
ClientWidth = 5145
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 3150
ScaleWidth = 5145
Begin VB.CommandButton Cancle
Caption = "取消"
Height = 495
Left = 3360
TabIndex = 7
Top = 2520
Width = 975
End
Begin VB.CommandButton Confirm
Caption = "确定"
Height = 495
Left = 1800
TabIndex = 6
Top = 2520
Width = 975
End
Begin VB.TextBox ConfirmPassword
Height = 495
IMEMode = 3 'DISABLE
Left = 1800
PasswordChar = "*"
TabIndex = 5
Top = 1800
Width = 2775
End
Begin VB.TextBox NewPassword
Height = 495
IMEMode = 3 'DISABLE
Left = 1800
PasswordChar = "*"
TabIndex = 2
Top = 1080
Width = 2775
End
Begin VB.TextBox OldPassword
Height = 495
IMEMode = 3 'DISABLE
Left = 1800
PasswordChar = "*"
TabIndex = 0
Top = 240
Width = 2775
End
Begin VB.Label TipConfirmPassword
Caption = "请再次输入新密码"
Height = 255
Left = 240
TabIndex = 4
Top = 1920
Width = 1455
End
Begin VB.Label TipCurrentPassword
Caption = "请输入新密码"
Height = 255
Left = 240
TabIndex = 3
Top = 1200
Width = 1455
End
Begin VB.Label TipOldPassword
Caption = "请输入原来的密码"
Height = 255
Left = 240
TabIndex = 1
Top = 360
Width = 1575
End
End
Attribute VB_Name = "setpassword"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Cancle_Click()
Unload Me
End Sub
Private Sub Confirm_Click()
If OldPassword = "" Or NewPassword = "" Or ConfirmPassword = "" Then '输入的项目不能为空
MsgBox "所有密码项不能为空!请填写", vbOKOnly, "输入错误"
ElseIf NewPassword <> ConfirmPassword Then
MsgBox "两次输入的新密码不符!请重新填写", vbOKOnly, "输入错误" '新密码不一致
OldPassword = ""
NewPassword = ""
ConfirmPassword = ""
Else
Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset
rst.Open "select password from employeeinfo where id='" & CurrentUser & "' and password='" & OldPassword & "'", cnn, adOpenDynamic, adLockOptimistic
If rst.EOF Then
MsgBox "原密码错误!请重新输入"
OldPassword = ""
NewPassword = ""
ConfirmPassword = ""
rst.Close
Set rst = Nothing
Else
cnn.Execute "update employeeinfo set password='" & NewPassword & "' where id='" & CurrentUser & "'"
MsgBox "密码修改成功!", vbOKOnly, "成功"
End If
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -