📄 frmxgmm.frm
字号:
VERSION 5.00
Begin VB.Form frmXGMM
BorderStyle = 3 'Fixed Dialog
Caption = "用户口令维护"
ClientHeight = 2025
ClientLeft = 2055
ClientTop = 1980
ClientWidth = 5805
Icon = "frmXGMM.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 1199.912
ScaleMode = 0 'User
ScaleWidth = 5444.64
ShowInTaskbar = 0 'False
Begin VB.TextBox txtPassword
Height = 345
IMEMode = 3 'DISABLE
Left = 1212
PasswordChar = "*"
TabIndex = 6
Top = 648
Width = 2325
End
Begin VB.CommandButton cmdDelete
Cancel = -1 'True
Caption = "删除"
Height = 390
Left = 3936
TabIndex = 5
Top = 1476
Width = 1140
End
Begin VB.CommandButton cmdChange
Caption = "修改"
Height = 390
Left = 3936
TabIndex = 4
Top = 852
Width = 1140
End
Begin VB.TextBox txtUserName
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H8000000D&
Height = 345
Left = 1212
TabIndex = 3
Top = 228
Width = 2325
End
Begin VB.TextBox Text1
Height = 345
IMEMode = 3 'DISABLE
Left = 1212
PasswordChar = "*"
TabIndex = 2
Top = 1056
Width = 2325
End
Begin VB.TextBox Text2
Height = 345
IMEMode = 3 'DISABLE
Left = 1212
PasswordChar = "*"
TabIndex = 1
Top = 1512
Width = 2325
End
Begin VB.CommandButton CmdAdd
Caption = "添加"
Height = 390
Left = 3960
TabIndex = 0
Top = 240
Width = 1140
End
Begin VB.Label lblLabels
AutoSize = -1 'True
Caption = "原口令:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 216
Index = 1
Left = 300
TabIndex = 10
Top = 708
Width = 732
End
Begin VB.Label lblLabels
AutoSize = -1 'True
Caption = "姓 名:"
BeginProperty Font
Name = "宋体"
Size = 11.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 228
Index = 0
Left = 300
TabIndex = 9
Top = 288
Width = 816
End
Begin VB.Label lblLabels
AutoSize = -1 'True
Caption = "新口令:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 216
Index = 2
Left = 324
TabIndex = 8
Top = 1116
Width = 732
End
Begin VB.Label lblLabels
AutoSize = -1 'True
Caption = "校对新口令"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 216
Index = 3
Left = 144
TabIndex = 7
Top = 1548
Width = 1056
End
End
Attribute VB_Name = "frmXGMM"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub CmdAdd_Click()
Dim strSQL As String
Dim power As String
If Format(txtUserName) = "" Then
MsgBox "请输入人员姓名! ", vbInformation
Exit Sub
End If
If Trim(Text1.Text) = "" Then
MsgBox "请输入人员口令! ", vbInformation
Exit Sub
End If
If Trim(Text2.Text) <> Trim(Text1.Text) Then
MsgBox "新口令校对不一致! ", vbExclamation, "添加操作员"
Exit Sub
End If
power = "A"
Select Case power
Case "A"
strSQL = "INSERT INTO t_account VALUES('" & txtUserName.Text & "','" & Text1.Text & "','A')"
Case "B"
strSQL = "INSERT INTO t_account VALUES('" & txtUserName.Text & "','" & Text1.Text & "','B')"
Case "C"
strSQL = "INSERT INTO t_account VALUES('" & txtUserName.Text & "','" & Text1.Text & "','C')"
Case Else
MsgBox "输入操作员权限错误! ", vbExclamation, "添加操作员"
Exit Sub
End Select
CN.Execute strSQL
MsgBox "操作员添加成功!", vbInformation
txtUserName.Text = ""
txtPassword.Text = ""
Text1.Text = ""
Text2.Text = ""
End Sub
Private Sub cmdChange_Click()
Dim Xmm As String
Dim Ymm As String
If Trim(Text2.Text) <> Trim(Text1.Text) Then
MsgBox "新口令校对不一致!", vbExclamation, "修改失败"
Exit Sub
End If
Xmm = Text2.Text
Dim strSQL As String
Dim dy2 As ADODB.Recordset
Set dy2 = New ADODB.Recordset
strSQL = "SELECT * FROM t_account WHERE user='" & txtUserName & "'"
dy2.Open strSQL, CN, adOpenStatic, adLockOptimistic
If dy2.BOF And dy2.EOF Then
MsgBox " 无此操作员! ", vbExclamation, "修改口令"
Exit Sub
Else
Ymm = dy2!pwd
End If
If txtPassword <> Ymm Then
MsgBox "原口令不正确!", vbCritical, "修改口令"
txtPassword.SetFocus
Exit Sub
End If
dy2!pwd = Xmm
dy2.UpdateBatch
MsgBox "口令修改成功!", vbInformation, "修改口令"
End Sub
Private Sub cmdDelete_Click()
If MsgBox("请确认删除操作员:" + vbCr + txtUserName, vbYesNo) = vbNo Then Exit Sub
On Error GoTo ErrHandle
CN1.Execute "DELETE FROM 操作权限表 WHERE 姓名='" & txtUserName & "'"
txtUserName.Text = ""
txtPassword.Text = ""
Text1.Text = ""
Text2.Text = ""
Exit Sub
ErrHandle:
MsgBox "发生数据错误,删除没有成功!"
End Sub
Private Sub Form_Load()
If sPopedom = "A" Then
cmdAdd.Enabled = True
cmdDelete.Enabled = True
txtUserName.Enabled = True
Else
cmdAdd.Enabled = False
cmdDelete.Enabled = False
txtUserName.Enabled = True
txtUserName.Text = sOperator
txtUserName.Locked = True
End If
Me.Move (Screen.Width - Me.Width) / 2, (Screen.Height - 1600 - Me.Height) / 2
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -