📄 changepass.frm
字号:
VERSION 5.00
Begin VB.Form changepass
Caption = "修改用户"
ClientHeight = 4275
ClientLeft = 135
ClientTop = 420
ClientWidth = 6690
LinkTopic = "Form1"
ScaleHeight = 4275
ScaleWidth = 6690
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame1
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "更改系统用户密码"
ForeColor = &H00764E10&
Height = 2625
Left = 960
TabIndex = 0
Top = 960
Width = 4905
Begin VB.TextBox txtpass3
Appearance = 0 'Flat
BackColor = &H00FFFFFF&
ForeColor = &H00987758&
Height = 315
IMEMode = 3 'DISABLE
Left = 1785
MaxLength = 10
PasswordChar = "*"
TabIndex = 7
ToolTipText = "Enter Password Here"
Top = 1725
Width = 2745
End
Begin VB.TextBox txtpass2
Appearance = 0 'Flat
BackColor = &H00FFFFFF&
ForeColor = &H00987758&
Height = 315
IMEMode = 3 'DISABLE
Left = 1785
MaxLength = 10
PasswordChar = "*"
TabIndex = 6
ToolTipText = "Enter Password Here"
Top = 1275
Width = 2745
End
Begin VB.TextBox txtlogin
Appearance = 0 'Flat
BackColor = &H00FFFFFF&
ForeColor = &H00987758&
Height = 315
Left = 1785
MaxLength = 15
TabIndex = 5
ToolTipText = "Enter LogIn ID Here"
Top = 405
Width = 2745
End
Begin VB.TextBox txtpass
Appearance = 0 'Flat
BackColor = &H00FFFFFF&
ForeColor = &H00987758&
Height = 315
IMEMode = 3 'DISABLE
Left = 1800
MaxLength = 10
PasswordChar = "*"
TabIndex = 4
ToolTipText = "Enter Password Here"
Top = 840
Width = 1275
End
Begin VB.CommandButton Command2
BackColor = &H00E2D1D3&
Caption = "取消"
Height = 375
Left = 3165
MaskColor = &H00987758&
Style = 1 'Graphical
TabIndex = 3
Top = 2145
UseMaskColor = -1 'True
Width = 1335
End
Begin VB.CommandButton command1
BackColor = &H00E2D1D3&
Caption = "确定"
Default = -1 'True
Height = 375
Left = 1800
MaskColor = &H00987758&
Style = 1 'Graphical
TabIndex = 2
Top = 2145
UseMaskColor = -1 'True
Width = 1335
End
Begin VB.CheckBox Check1
BackColor = &H00FFFFFF&
Caption = "管理员?"
ForeColor = &H00987758&
Height = 285
Left = 3210
TabIndex = 1
Top = 885
Width = 1485
End
Begin VB.Label Label7
Alignment = 1 'Right Justify
BackStyle = 0 'Transparent
Caption = "确认密码:"
ForeColor = &H00987758&
Height = 285
Left = 0
TabIndex = 11
Top = 1755
Width = 1755
End
Begin VB.Label Label6
Alignment = 1 'Right Justify
BackStyle = 0 'Transparent
Caption = "新密码:"
ForeColor = &H00987758&
Height = 285
Left = 60
TabIndex = 10
Top = 1305
Width = 1665
End
Begin VB.Label Label4
Alignment = 1 'Right Justify
BackStyle = 0 'Transparent
Caption = "用户名:"
ForeColor = &H00987758&
Height = 285
Left = 345
TabIndex = 9
Top = 435
Width = 1425
End
Begin VB.Label Label5
Alignment = 1 'Right Justify
BackStyle = 0 'Transparent
Caption = "原始密码:"
ForeColor = &H00987758&
Height = 285
Left = 720
TabIndex = 8
Top = 840
Width = 1050
End
End
End
Attribute VB_Name = "changepass"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub command1_Click()
If txtlogin.Text = "" Then
MsgBox "Enter A Login ID:", vbCritical
txtlogin.SetFocus
Exit Sub
End If
If txtpass.Text = "" Then
MsgBox "Enter current or Administrator's Password:", vbCritical
txtpass.SetFocus
Exit Sub
End If
If txtpass2.Text = "" Then
MsgBox "Enter A New Password:", vbCritical
txtpass2.SetFocus
Exit Sub
End If
If txtpass3.Text = "" Then
MsgBox "Enter A Confirmation Password:", vbCritical
txtpass3.SetFocus
Exit Sub
End If
If txtpass2.Text <> txtpass3.Text Then
MsgBox "Password & Confirm Passwords Donot Match!", vbCritical
txtpass2.Text = ""
txtpass3.Text = ""
txtpass2.SetFocus
Exit Sub
End If
If Check1.Value = 0 Then
Call openconn
sqlstr = "select * from users where loginid = '" & Crypt(txtlogin.Text) & "'"
Call rs(sqlstr)
If (adoRS.EOF) Then
MsgBox "Login ID Does Not Exist! Enter Correct Login ID", vbCritical
txtlogin.Text = ""
txtlogin.SetFocus
Call closeconn
Exit Sub
End If
Call closeconn
End If
Call openconn
If Check1.Value = 1 Then
sqlstr = "select * from users where loginid = '" & Crypt("administrator") & "' and pass = '" & Crypt(txtpass.Text) & "'"
Else
sqlstr = "select * from users where loginid = '" & Crypt(txtlogin.Text) & "' and pass = '" & Crypt(txtpass.Text) & "'"
End If
Call rs(sqlstr)
If (adoRS.EOF) Then
If Check1.Value = 1 Then
MsgBox "Wrong Administrator Password! Try Again With Correct Administrator Password", vbCritical
Else
MsgBox "Wrong Current Password! Try Again With Correct Current Password", vbCritical
End If
txtpass.Text = ""
txtpass.SetFocus
Call closeconn
Exit Sub
End If
Call closeconn
Call openconn
sqlstr = "update users set pass = '" & Crypt(txtpass2.Text) & "' where loginid = '" & Crypt(txtlogin.Text) & "'"
Call rs(sqlstr)
Call closeconn
MsgBox "Password Changed Successfully!", vbInformation
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -