📄 changepass.frm
字号:
VERSION 5.00
Begin VB.Form changePass
Caption = "修改密码"
ClientHeight = 3060
ClientLeft = 60
ClientTop = 345
ClientWidth = 3570
Icon = "changePass.frx":0000
LinkTopic = "Form1"
ScaleHeight = 3060
ScaleWidth = 3570
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Caption = "取消"
Height = 375
Left = 2400
TabIndex = 9
Top = 2520
Width = 855
End
Begin VB.CommandButton Command1
BackColor = &H0080FF80&
Caption = "确定"
Height = 375
Left = 1320
TabIndex = 8
Top = 2520
Width = 855
End
Begin VB.TextBox Text4
BackColor = &H00C0FFFF&
Height = 375
IMEMode = 3 'DISABLE
Left = 1080
PasswordChar = "*"
TabIndex = 7
Top = 1920
Width = 2175
End
Begin VB.TextBox Text3
BackColor = &H00C0FFFF&
Height = 375
IMEMode = 3 'DISABLE
Left = 1080
PasswordChar = "*"
TabIndex = 5
Top = 1320
Width = 2175
End
Begin VB.TextBox Text2
BackColor = &H00C0FFFF&
Height = 375
IMEMode = 3 'DISABLE
Left = 1080
PasswordChar = "*"
TabIndex = 3
Top = 720
Width = 2175
End
Begin VB.TextBox Text1
BackColor = &H00C0FFFF&
Height = 375
Left = 1080
TabIndex = 1
Top = 120
Width = 2175
End
Begin VB.Label Label4
Caption = "验证:"
Height = 375
Left = 240
TabIndex = 6
Top = 2040
Width = 735
End
Begin VB.Label Label3
Caption = "新密码:"
Height = 375
Left = 240
TabIndex = 4
Top = 1440
Width = 735
End
Begin VB.Label Label2
Caption = "旧密码:"
Height = 255
Left = 240
TabIndex = 2
Top = 840
Width = 735
End
Begin VB.Label Label1
Caption = "用户名:"
Height = 255
Left = 240
TabIndex = 0
Top = 240
Width = 735
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()
On Error GoTo errh
Dim chp As ADODB.Recordset
Set chp = New ADODB.Recordset
If Text1.Text <> "" Then
Dim sqlchp As String
sqlchp = "SELECT Username FROM 技术人员 WHERE Username =" & "'" & Text1.Text & "'"
Call chp.open(sqlchp, cn, adOpenKeyset, adLockOptimistic, -1)
'Set chp = cn.Execute("SELECT Username FROM 技术人员 WHERE Username =" & "'" & Text1.Text & "'")
If chp.EOF Then
MsgBox "该用户名不存在!", , changePass.Caption
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Exit Sub
Else
chp.Close '该用户存在
End If
If Text2.Text <> "" Then
If Text3.Text <> "" Then
If Text3.Text = Text4.Text Then
' Set chp = cn.Execute("SELECT * FROM 技术人员 ")
' If chp.EOF Then
' chp.Close
' Exit Sub
' End If
'chp.Close
chp.LockType = adLockOptimistic
chp.CursorType = adOpenKeyset
chp.open "技术人员", cn, , , adCmdTable
chp.find ("UserName=" & "'" & Text1.Text & "'")
If chp.Fields("Password").Value = Text2.Text Then
chp.Update "Password", Text3.Text
chp.Close
Me.Hide
upok = True
MsgBox "修改成功!", , changePass.Caption
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Else
MsgBox "旧密码错误", , changePass.Caption
End If
Else
MsgBox "新密码不一致", , changePass.Caption
End If
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Else
MsgBox "新密码不能为空", , changePass.Caption
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
End If
Else
MsgBox "旧密码不能为空", , changePass.Caption
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
End If
Else
MsgBox "用户名不能为空", , changePass.Caption
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
End If
Exit Sub
errh:
MsgBox Err.Description
End Sub
Private Sub Command2_Click()
Unload Me
upok = False
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
End Sub
Private Sub Form_Load()
MakeCenter changePass
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -