📄 adduser.frm
字号:
VERSION 5.00
Begin VB.Form addoperator
Caption = "添加用户"
ClientHeight = 3690
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3690
ScaleWidth = 4680
StartUpPosition = 2 'CenterScreen
Begin VB.CheckBox Chklevel
Caption = "Check1"
Height = 255
Left = 1440
TabIndex = 8
Top = 2400
Width = 255
End
Begin VB.CommandButton cmdcancel
Caption = "取消"
BeginProperty Font
Name = "宋体"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 2640
TabIndex = 7
Top = 2880
Width = 975
End
Begin VB.CommandButton cmdok
Caption = "确定"
BeginProperty Font
Name = "宋体"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1080
TabIndex = 6
Top = 2880
Width = 975
End
Begin VB.TextBox txtpwd2
Height = 495
IMEMode = 3 'DISABLE
Left = 1920
PasswordChar = "*"
TabIndex = 5
Top = 1680
Width = 1695
End
Begin VB.TextBox txtpwd1
Height = 495
IMEMode = 3 'DISABLE
Left = 1920
PasswordChar = "*"
TabIndex = 4
Top = 960
Width = 1695
End
Begin VB.TextBox txtusername
Height = 495
Left = 1920
TabIndex = 3
Top = 240
Width = 1695
End
Begin VB.Label Label4
Alignment = 2 'Center
Caption = "系统用户"
Height = 255
Left = 1800
TabIndex = 9
Top = 2400
Width = 1095
End
Begin VB.Label Label3
Alignment = 2 'Center
Caption = "请确认密码"
BeginProperty Font
Name = "宋体"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 360
TabIndex = 2
Top = 1800
Width = 1215
End
Begin VB.Label Label2
Alignment = 2 'Center
Caption = "请输入密码"
BeginProperty Font
Name = "宋体"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 360
TabIndex = 1
Top = 1080
Width = 1215
End
Begin VB.Label Label1
Alignment = 2 'Center
Caption = "请输入用户名"
BeginProperty Font
Name = "宋体"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 360
TabIndex = 0
Top = 360
Width = 1215
End
End
Attribute VB_Name = "addoperator"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public sysoper As Boolean
Private Sub Chklevel_Click()
sysoper = True
End Sub
Private Sub cmdcancel_Click()
Unload Me
End Sub
Private Sub cmdok_Click()
Dim txtsql As String
Dim mrc As ADODB.Recordset
Dim msgtext As String
If Trim(txtusername.Text) = "" Then
MsgBox "请输入用户名称!", vbOKOnly + vbExclamation, "警告"
Exit Sub
txtursername.SetFocus
Else
txtsql = "select * from operator"
Set mrc = ExecuteSQL(txtsql, msgtext)
While (mrc.EOF = False)
If Trim(mrc.Fields(0)) = Trim(txtusername) Then
MsgBox "用户已存在,请重新输入用户名!", vbOKOnly + vbExclamation, "警告"
txtusername.SetFocus
txtusername.Text = ""
txtpwd1.Text = ""
txtpwd2.Text = ""
Exit Sub
Else
mrc.MoveNext
End If
Wend
End If
If Trim(txtpwd1.Text) <> Trim(txtpwd2.Text) Then
MsgBox "两次输入的密码不一样,请确认!", vbOKOnly + vbExclamation, "警告"
txtpwd1.SetFocus
txtpwd1.Text = ""
txtpwd2.Text = ""
Exit Sub
Else
If txtpwd1.Text = "" Then
MsgBox "密码不能为空!", vbOKOnly + vbExclamation, "警告"
txtpwd1.SetFocus
txtpwd2.Text = ""
Else
mrc.AddNew
mrc.Fields(0) = Trim(txtusername.Text)
mrc.Fields(1) = Trim(txtpwd1.Text)
If sysoper = True Then
mrc.Fields(2) = "H"
Else: mrc.Fields(2) = "M"
End If
mrc.Update
mrc.Close
Unload Me
MsgBox "添加用户成功!", vbOKOnly, "添加用户"
End If
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -