📄 frmchpwd.frm
字号:
VERSION 5.00
Begin VB.Form frmChPwd
BorderStyle = 1 'Fixed Single
Caption = "修改密码"
ClientHeight = 3780
ClientLeft = 45
ClientTop = 330
ClientWidth = 4980
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 3780
ScaleWidth = 4980
Begin VB.CommandButton cmdChPwdCancel
Caption = "取 消"
Height = 495
Left = 2760
TabIndex = 10
Top = 3120
Width = 1455
End
Begin VB.CommandButton cmdChPwdOk
Caption = "确 定"
Height = 495
Left = 720
TabIndex = 9
Top = 3120
Width = 1455
End
Begin VB.Frame fraChPwd
Height = 2775
Left = 240
TabIndex = 0
Top = 120
Width = 4455
Begin VB.TextBox txtNewPwdagain
Height = 405
Left = 1560
TabIndex = 8
Top = 2160
Width = 2055
End
Begin VB.TextBox txtNewPwd
Height = 375
Left = 1560
TabIndex = 7
Top = 1560
Width = 2055
End
Begin VB.TextBox txtOldPwd
Height = 375
Left = 1560
TabIndex = 6
Top = 960
Width = 2055
End
Begin VB.TextBox txtChUser
Height = 375
Left = 1560
TabIndex = 5
Top = 360
Width = 2055
End
Begin VB.Label lblPwdagain
Caption = "新密码:"
Height = 375
Left = 480
TabIndex = 4
Top = 2280
Width = 855
End
Begin VB.Label lblNewPwd
Caption = "新密码:"
Height = 375
Left = 480
TabIndex = 3
Top = 1680
Width = 855
End
Begin VB.Label lblOldPwd
Caption = "原密码:"
Height = 375
Left = 480
TabIndex = 2
Top = 1080
Width = 855
End
Begin VB.Label lblChUser
Caption = "用户名:"
Height = 375
Left = 480
TabIndex = 1
Top = 480
Width = 855
End
End
End
Attribute VB_Name = "frmChPwd"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdChPwdCancel_Click()
Unload Me
End Sub
Private Sub cmdChPwdOk_Click()
Dim rstUser As New ADODB.Recordset
Dim sql As String
'先检测两次输入的新密码时候一样
If txtNewPwd.Text <> txtNewPwdagain.Text Then
MsgBox "两次输入的密码不同!请重新输入", vbOKOnly + vbInformation, ""
'光标定位于新密码textbox中
txtNewPwd.SetFocus
Exit Sub
End If
sql = "select * from userdb where 用户名 = '" & txtChUser.Text & "' and " _
& " 密码= '" & txtOldPwd.Text & "'"
rstUser.Open sql, conn, adOpenKeyset, adLockPessimistic
If rstUser.EOF = True Then
MsgBox "用户名或老密码错误", vbOKOnly + vbExclamation, ""
txtChUser.Text = ""
txtChUser.SetFocus
txtOldPwd.Text = ""
rstUser.Close
Exit Sub
Else
rstUser.Fields(2) = txtNewPwd.Text
rstUser.Update
MsgBox "修改密码成功!", vbOKOnly + vbInformation, ""
rstUser.Close
Unload Me '退出本窗口
End If
End Sub
Private Sub Form_Load()
'让窗体居中
Call MakeCenter(Me)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -