📄 frmmdpassword.frm
字号:
VERSION 5.00
Begin VB.Form frmMdpassword
BorderStyle = 1 'Fixed Single
Caption = "修改密码"
ClientHeight = 4425
ClientLeft = 45
ClientTop = 330
ClientWidth = 5205
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4425
ScaleWidth = 5205
StartUpPosition = 3 'Windows Default
Begin VB.PictureBox Picture1
AutoSize = -1 'True
Height = 420
Left = 240
Picture = "frmMdpassword.frx":0000
ScaleHeight = 360
ScaleWidth = 435
TabIndex = 10
Top = 240
Width = 495
End
Begin VB.TextBox txtCom
Height = 435
IMEMode = 3 'DISABLE
Left = 2400
PasswordChar = "*"
TabIndex = 9
Top = 2640
Width = 1815
End
Begin VB.CommandButton cmdExit
Caption = "取消"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = -1 'True
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 3120
TabIndex = 7
Top = 3480
Width = 1095
End
Begin VB.CommandButton cmdOk
Caption = "确定"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = -1 'True
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 960
TabIndex = 6
Top = 3480
Width = 1335
End
Begin VB.TextBox txtNewpassword
Height = 435
IMEMode = 3 'DISABLE
Left = 2400
PasswordChar = "*"
TabIndex = 5
Top = 1920
Width = 1815
End
Begin VB.TextBox txtOldpassword
Height = 435
IMEMode = 3 'DISABLE
Left = 2400
PasswordChar = "*"
TabIndex = 4
Top = 1080
Width = 1815
End
Begin VB.TextBox txtUser
Height = 435
Left = 2400
TabIndex = 3
Top = 360
Width = 1815
End
Begin VB.Label Label4
Caption = "再次输入新密码"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C00000&
Height = 255
Left = 720
TabIndex = 8
Top = 2760
Width = 1455
End
Begin VB.Label Label3
Caption = "旧密码:"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C00000&
Height = 255
Left = 1200
TabIndex = 2
Top = 1200
Width = 735
End
Begin VB.Label Label2
Caption = "新密码:"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C00000&
Height = 255
Left = 1200
TabIndex = 1
Top = 2040
Width = 735
End
Begin VB.Label Label1
Caption = "用户名:"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C00000&
Height = 375
Left = 1200
TabIndex = 0
Top = 480
Width = 735
End
End
Attribute VB_Name = "frmMdpassword"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdExit_Click()
Me.Hide
End Sub
'添加用户
Private Sub cmdOK_Click()
On Error GoTo errh
Set rs = New ADODB.Recordset
If txtUser.Text <> "" Then
If txtOldpassword.Text <> "" Then
If txtNewpassword.Text <> "" Then
If txtNewpassword.Text = txtCom.Text Then
Set rs = CN.Execute("Select * From 用户")
If rs.EOF Then
MsgBox "数据库中没有用户,请先添加用户"
rs.Close
Set rs = Nothing
Unload Me
Show frmMain
Exit Sub
End If
rs.Close
rs.LockType = adLockOptimistic
rs.CursorType = adOpenKeyset
rs.Open "用户", CN, , , adCmdTable
rs.Find ("UserName=" & "'" & txtUser.Text & "'")
If rs.Fields("Password").Value = txtOldpassword.Text Then
rs.Update "Password", txtNewpassword.Text
rs.Close
Me.Hide
MsgBox "修改成功!"
Else
MsgBox "旧密码错误!"
rs.Close
txtOldpassword.SetFocus
End If
Else
MsgBox "两次输入的密码不一致!请重新输入!"
txtNewpassword.SetFocus
End If
Else
MsgBox "新密码不能为空!"
txtNewpassword.SetFocus
End If
Else
MsgBox "旧密码不能为空!"
txtOldpassword.SetFocus
End If
Else
MsgBox "用户名不能为空!"
Me.txtUser.SetFocus
End If
Exit Sub
errh:
MsgBox Err.Description
End Sub
Private Sub Form_Load()
MakeCenter Me '窗体位于屏幕中间
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -