📄 frmlandingnew.frm
字号:
VERSION 5.00
Begin VB.Form FrmLandingNew
BorderStyle = 3 'Fixed Dialog
Caption = "添加操作用户"
ClientHeight = 2730
ClientLeft = 4050
ClientTop = 3615
ClientWidth = 5190
Icon = "FrmLandingNew.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 2730
ScaleWidth = 5190
ShowInTaskbar = 0 'False
Begin VB.TextBox txtPWDOK
Height = 315
IMEMode = 3 'DISABLE
Left = 1320
PasswordChar = "*"
TabIndex = 9
Top = 1200
Width = 2055
End
Begin VB.ComboBox cboPopedom
Height = 300
Left = 1320
Style = 2 'Dropdown List
TabIndex = 6
Top = 1680
Width = 2055
End
Begin VB.TextBox txtPWD
Height = 315
IMEMode = 3 'DISABLE
Left = 1320
PasswordChar = "*"
TabIndex = 5
Top = 720
Width = 2055
End
Begin VB.TextBox txtName
Height = 315
Left = 1320
TabIndex = 4
Top = 240
Width = 2295
End
Begin VB.CommandButton CmdExit
Caption = "退出"
Height = 375
Left = 4080
TabIndex = 1
Top = 2280
Width = 975
End
Begin VB.CommandButton CmdSave
Caption = "保存"
Height = 375
Left = 2760
TabIndex = 0
Top = 2280
Width = 975
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "口令确认"
Height = 195
Left = 240
TabIndex = 8
Top = 1320
Width = 720
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "操作员权限"
Height = 195
Left = 240
TabIndex = 7
Top = 1800
Width = 900
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "操作员口令"
Height = 195
Left = 240
TabIndex = 3
Top = 840
Width = 900
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "操作员名称"
Height = 195
Left = 240
TabIndex = 2
Top = 360
Width = 900
End
End
Attribute VB_Name = "FrmLandingNew"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub CmdExit_Click()
Unload Me
End Sub
Private Sub Cmdsave_Click()
Dim strInsertSQL As String
Dim strSelectSQL As String
'判断输入的数据是否完整
If ((Trim(txtName.Text) = Empty) Or (Trim(txtPWD.Text) = Empty) _
Or (Trim(txtPWDOK.Text) = Empty)) Then
MsgBox "请输入所有的数据...", vbInformation + vbOKOnly, "操作员资料不完整"
'判断密码正确性
ElseIf txtPWD.Text <> txtPWDOK.Text Then
MsgBox "密码与确认密码不符", vbOKOnly, "密码不符"
txtPWD.Text = ""
txtPWDOK.Text = ""
' 弹出消息框,用户确认输入的数据是否准确
ElseIf MsgBox("操作员名称:" & Trim(txtName.Text) & vbCrLf & _
"操作员密码:" & Trim(txtPWD.Text) & vbCrLf & _
"操作员权限:" & cboPopedom.Text _
, vbOKCancel, "操作员资料确认") = vbOK Then
strSelectSQL = "select username from uservalidate where username='" & _
Trim(txtName.Text) & "'"
'判断操作员名称是否重复
If QueryEmpInfo(strSelectSQL) = True And g_DBRct.BOF = False And g_DBRct.EOF = False Then
MsgBox "已经存在此操作员,请重新输入操作员名称", vbOKOnly, "操作员存在"
txtName.Text = ""
txtPWD.Text = ""
txtPWDOK.Text = ""
Else
strInsertSQL = "INSERT INTO UserValidate(UserName,UserPWD,UserPopedom)VALUES("
strInsertSQL = strInsertSQL & "'" & Trim(txtName.Text) & "'"
strInsertSQL = strInsertSQL & ",'" & Trim(txtPWD.Text) & "'"
If cboPopedom.Text = "管理员" Then
strInsertSQL = strInsertSQL & ",1)"
Else
strInsertSQL = strInsertSQL & ",0)"
End If
If QueryEmpInfo(strInsertSQL) = True Then
MsgBox "登陆员资料已保存...", vbOKOnly, "保存成功"
txtName.Text = ""
txtPWD.Text = ""
txtPWDOK.Text = ""
End If
End If
End If
End Sub
Private Sub Form_Load()
'窗体加载时列表框中自动生成内容,并有默认值
cboPopedom.Clear
cboPopedom.AddItem "管理员"
cboPopedom.AddItem "普通用户"
cboPopedom.ListIndex = 0
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -