📄 adduser.frm
字号:
VERSION 5.00
Begin VB.Form Adduser
BorderStyle = 1 'Fixed Single
Caption = "添加管理员"
ClientHeight = 3360
ClientLeft = 45
ClientTop = 435
ClientWidth = 4065
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 3360
ScaleWidth = 4065
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command2
Caption = "关闭(&C)"
Height = 375
Left = 2880
TabIndex = 10
Top = 2880
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "添加(&A)"
Height = 375
Left = 1680
TabIndex = 9
Top = 2880
Width = 1095
End
Begin VB.Frame Frame1
Caption = "添加信息"
Height = 2535
Left = 120
TabIndex = 0
Top = 120
Width = 3855
Begin VB.OptionButton Option2
Caption = "操作员"
Height = 375
Left = 2160
TabIndex = 8
Top = 1920
Width = 1215
End
Begin VB.OptionButton Option1
Caption = "管理员"
Height = 375
Left = 720
TabIndex = 7
Top = 1920
Width = 1095
End
Begin VB.TextBox Text3
Appearance = 0 'Flat
BackColor = &H00C0FFFF&
Height = 375
IMEMode = 3 'DISABLE
Left = 1200
PasswordChar = "*"
TabIndex = 6
Top = 1200
Width = 2175
End
Begin VB.TextBox Text2
Appearance = 0 'Flat
BackColor = &H00C0FFFF&
Height = 375
IMEMode = 3 'DISABLE
Left = 1200
PasswordChar = "*"
TabIndex = 4
Top = 720
Width = 2175
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
BackColor = &H00C0FFFF&
Height = 375
Left = 1200
TabIndex = 2
Top = 240
Width = 2175
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "密码确认:"
Height = 180
Left = 240
TabIndex = 5
Top = 1320
Width = 900
End
Begin VB.Label Label2
Caption = "密 码:"
Height = 375
Left = 240
TabIndex = 3
Top = 840
Width = 735
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "用户名:"
Height = 180
Left = 240
TabIndex = 1
Top = 360
Width = 720
End
End
End
Attribute VB_Name = "Adduser"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Command1_Click()
Dim SQL As String
If Text1.Text = "" Then
MsgBox "对不起,用户名必须填写", vbInformation + vbOKOnly, "警告"
Text1.SetFocus
Exit Sub
End If
If Text2.Text = "" Then
MsgBox "对不起,密码必须填写", vbInformation + vbOKOnly, "警告"
Text2.SetFocus
Exit Sub
End If
If Text3.Text = "" Then
MsgBox "对不起,密码确认必须填写", vbInformation + vbOKOnly, "警告"
Text3.SetFocus
Exit Sub
End If
If Text2.Text <> Text3.Text Then
MsgBox "对不起,两次密码输入不一致,请重新输入", vbInformation + vbOKOnly, "警告"
Text2.Text = ""
Text3.Text = ""
Text2.SetFocus
Exit Sub
End If
If Option1.Value = False And Option2.Value = False Then
MsgBox "对不起,你需要选择管理权限!", vbInformation + vbOKOnly, "警告"
Exit Sub
End If
SQL = "select 用户 from usetable where 用户=""" & Text1.Text & """"
OpenDBFile
OpenRS (SQL)
If Not gRst.EOF Then
MsgBox "对不起,你所输入的用户名已经存在,请换一个用户名!", vbInformation + vbOKOnly, "提示"
Text1.Text = ""
Text1.SetFocus
CloseRS
Exit Sub
Else
CloseRS
OpenDBFile
If Option1.Value = True Then
SQL = "insert into usetable(用户,密码,管理员)values(""" & Text1.Text & """,""" & Text2.Text & """,true)"
gCon.Execute SQL
End If
If Option2.Value = True Then
SQL = "insert into usetable(用户,密码,操作员)values(""" & Text1.Text & """,""" & Text2.Text & """,true)"
gCon.Execute SQL
End If
CloseDBFile
FrmUseSet.Adodc1.Refresh
Text1.Text = ""
Text2.Text = ""
Option1.Value = False
Option2.Value = False
MsgBox "管理员添加成功!", vbInformation + vbOKOnly, "提示"
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -