📄 form10.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form Form10
Caption = "添加用户"
ClientHeight = 4815
ClientLeft = 60
ClientTop = 345
ClientWidth = 5655
LinkTopic = "Form10"
ScaleHeight = 4815
ScaleWidth = 5655
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 120
Top = 4320
Visible = 0 'False
Width = 1215
_ExtentX = 2143
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=RSGL.mdb;Persist Security Info=False"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=RSGL.mdb;Persist Security Info=False"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.Frame Frame1
Height = 975
Left = 2640
TabIndex = 6
Top = 2520
Width = 1935
Begin VB.OptionButton Option2
Caption = "Option2"
Height = 255
Left = 240
TabIndex = 10
Top = 600
Width = 255
End
Begin VB.OptionButton Option1
Caption = "Option1"
Height = 255
Left = 240
TabIndex = 8
Top = 240
Value = -1 'True
Width = 255
End
Begin VB.Label Label5
Caption = "管理人员"
Height = 255
Left = 720
TabIndex = 11
Top = 600
Width = 735
End
Begin VB.Label Label4
Caption = "普通用户"
Height = 255
Left = 720
TabIndex = 9
Top = 240
Width = 735
End
End
Begin VB.CommandButton Command2
Caption = "退 出"
Height = 495
Left = 3240
TabIndex = 5
Top = 3840
Width = 1215
End
Begin VB.CommandButton Command1
BackColor = &H00C0E0FF&
Caption = "确 定"
Height = 495
Left = 1080
MaskColor = &H00C0C0FF&
TabIndex = 4
Top = 3840
Width = 1215
End
Begin VB.TextBox Text2
Height = 495
IMEMode = 3 'DISABLE
Left = 2760
PasswordChar = "*"
TabIndex = 3
Top = 1800
Width = 1575
End
Begin VB.TextBox Text1
Height = 495
IMEMode = 3 'DISABLE
Left = 2760
TabIndex = 1
Top = 1080
Width = 1575
End
Begin VB.Label Label6
Caption = "输入要添加用户的信息:"
BeginProperty Font
Name = "幼圆"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000001&
Height = 375
Left = 960
TabIndex = 12
Top = 360
Width = 3375
End
Begin VB.Label Label3
Caption = "用 户 权 限"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 840
TabIndex = 7
Top = 2880
Width = 1455
End
Begin VB.Label Label2
Caption = "用 户 密 码"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 840
TabIndex = 2
Top = 1920
Width = 1455
End
Begin VB.Label Label1
Caption = "用 户 姓 名"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 840
TabIndex = 0
Top = 1200
Width = 1335
End
End
Attribute VB_Name = "Form10"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
If Text1.Text = "" Or Text2.Text = "" Then '用户姓名密码判断是否为空
a = MsgBox("用户姓名或用户密码不能为空", , "错误!")
Else
Adodc1.RecordSource = "select * from 用户管理 where 用户姓名='" & Text1.Text & "'"
'查询输入的用户姓名是否已经存在
Adodc1.Refresh
If Adodc1.Recordset.EOF Then ' 不存在此用户名,添加新用户
If Option2.Value = True Then ' 选择普通用户
Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields("用户姓名") = Text1.Text
Adodc1.Recordset.Fields("用户密码") = Text2.Text
Adodc1.Recordset.Fields("用户权限") = 1
Adodc1.Recordset.Update
a = MsgBox("用户添加成功!", , "操作成功!")
Else ' 选择管理人员
Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields("用户姓名") = Text1.Text
Adodc1.Recordset.Fields("用户密码") = Text2.Text
Adodc1.Recordset.Fields("用户权限") = 0
Adodc1.Recordset.Update
a = MsgBox("用户添加成功!", , "操作成功!")
End If
Else
a = MsgBox("已有此用户纪录!", , "错误!")
End If
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Form10.Left = 2800
Form10.Top = 1500
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -