📄 dlgpass.frm
字号:
VERSION 5.00
Begin VB.Form DlgPass
BorderStyle = 3 'Fixed Dialog
Caption = "密码对话框"
ClientHeight = 1815
ClientLeft = 3585
ClientTop = 3150
ClientWidth = 3960
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Icon = "DlgPass.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1815
ScaleWidth = 3960
ShowInTaskbar = 0 'False
Begin VB.TextBox Text3
BackColor = &H80000004&
Height = 270
IMEMode = 3 'DISABLE
Left = 1200
PasswordChar = "*"
TabIndex = 7
Top = 840
Width = 2535
End
Begin VB.TextBox Text2
BackColor = &H80000004&
Height = 270
IMEMode = 3 'DISABLE
Left = 1200
PasswordChar = "*"
TabIndex = 5
Top = 480
Width = 2535
End
Begin VB.TextBox Text1
BackColor = &H80000004&
Height = 270
Left = 1200
TabIndex = 3
Top = 120
Width = 2535
End
Begin VB.CommandButton CancelButton
Cancel = -1 'True
Caption = "取消"
Height = 375
Left = 2520
TabIndex = 1
Top = 1320
Width = 1215
End
Begin VB.CommandButton OKButton
Caption = "确定"
Default = -1 'True
Height = 375
Left = 1200
TabIndex = 0
Top = 1320
Width = 1215
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "Label3"
Height = 180
Left = 120
TabIndex = 6
Top = 840
Width = 540
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "Label2"
Height = 180
Left = 120
TabIndex = 4
Top = 480
Width = 540
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "Label1"
Height = 180
Left = 120
TabIndex = 2
Top = 120
Width = 540
End
End
Attribute VB_Name = "DlgPass"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public addnewstate As Boolean
Public upok As Boolean
Private Sub CancelButton_Click()
Me.Hide
upok = False
End Sub
Private Sub Form_Paint()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
End Sub
Private Sub OKButton_Click()
On Error GoTo errh
Dim rs As New Recordset
If addnewstate Then
If Text1.Text <> "" Then
If Text2.Text <> "" Then
If Text3.Text = Text2.Text Then
rs.LockType = adLockOptimistic
rs.CursorType = adOpenKeyset
rs.Open "超级用户", cn, , , adCmdTable
rs.AddNew
rs.Fields("Password").Value = Text2.Text
rs.Fields("UserName").Value = Text1.Text
rs.Update
rs.Close
Me.Hide
upok = True
Else
MsgBox "密码错误"
End If
End If
Else
MsgBox "用户名不能为空"
End If
Else
If Text2.Text <> "" Then
If Text2.Text = Text3.Text Then
Set rs = cn.Execute("SELECT * FROM 超级用户 WHERE UserName=" & "'" & frmStat.List1.List(frmStat.List1.ListIndex) & "'")
If rs.EOF Then
rs.Close
Exit Sub
End If
rs.Close
rs.LockType = adLockOptimistic
rs.CursorType = adOpenKeyset
rs.Open "超级用户", cn, , , adCmdTable
rs.Find ("UserName=" & "'" & frmStat.List1.List(frmStat.List1.ListIndex) & "'")
If rs.Fields("Password").Value = Text1.Text Then
rs.Update "Password", Text2.Text
rs.Close
Me.Hide
upok = True
Else
MsgBox "错误的的旧密码"
rs.Close
End If
Else
MsgBox "密码错误"
End If
Else
MsgBox "用户名不能为空"
End If
End If
Exit Sub
errh:
MsgBox Err.Description
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -