📄 form3.frm
字号:
VERSION 5.00
Begin VB.Form 添加用户
Caption = "添加用户"
ClientHeight = 5535
ClientLeft = 60
ClientTop = 345
ClientWidth = 7245
LinkTopic = "Form3"
ScaleHeight = 5535
ScaleWidth = 7245
Begin VB.ComboBox Combo1
Height = 300
Left = 3240
TabIndex = 9
Top = 2880
Width = 2055
End
Begin VB.TextBox Text3
Height = 615
IMEMode = 3 'DISABLE
Left = 3120
PasswordChar = "*"
TabIndex = 7
Top = 1920
Width = 2295
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 975
Left = 2640
TabIndex = 5
Top = 4080
Width = 2175
End
Begin VB.CommandButton Command1
Caption = "确认"
Height = 975
Left = 120
TabIndex = 4
Top = 4080
Width = 2175
End
Begin VB.TextBox Text2
Height = 495
IMEMode = 3 'DISABLE
Left = 3120
PasswordChar = "*"
TabIndex = 3
Top = 1200
Width = 2175
End
Begin VB.TextBox Text1
Height = 615
Left = 3120
TabIndex = 1
Top = 240
Width = 2055
End
Begin VB.Label Label4
Caption = " 权限级别"
Height = 615
Left = 360
TabIndex = 8
Top = 2640
Width = 2055
End
Begin VB.Label Label3
Caption = "请确认密码"
Height = 495
Left = 360
TabIndex = 6
Top = 1920
Width = 2175
End
Begin VB.Label Label2
Caption = "请输入密码"
Height = 495
Left = 480
TabIndex = 2
Top = 1200
Width = 2055
End
Begin VB.Label Label1
Caption = "请输入用户名"
Height = 495
Left = 480
TabIndex = 0
Top = 360
Width = 2055
End
End
Attribute VB_Name = "添加用户"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs115 As New ADODB.Recordset
Dim rs5 As New ADODB.Recordset
Private Sub Command1_Click()
If rs5.State <> 0 Then rs5.Close
rs5.Open "select * from 用户表", cnn, 3, 3
If rs115.State <> 0 Then rs115.Close
rs115.Open "select * from 用户权限表", cnn, 3, 3
If Text2 <> Text3 Then
MsgBox "您两次输入的密码不同,请重新输入!"
Text2.SetFocus
Text2 = ""
Text3 = ""
Else
rs5.AddNew
rs115.AddNew
rs5("用户名") = Trim(Text1)
rs115("用户名") = Trim(Text1)
rs5("密码") = Trim(Text2)
rs5("权限级别") = Combo1.text
rs5.Update
rs115.Update
rs5.Requery
rs115.Requery
MsgBox "添加成功!"
Text1 = ""
Text2 = ""
Text3 = ""
End If
If rs5.State <> 0 Then rs5.Close
rs5.Open "select * from 用户表 where 用户名='" & Trim(Text1) & "'", cnn, 3, 3
rs5.Find "用户名= '" & Trim(Text1) & "'"
If rs5.EOF = False Then
MsgBox "对不起,您要添加的用户已经存在,请重新输入!"
Text1 = ""
End If
End Sub
Private Sub Command2_Click()
Me.Hide
End Sub
Private Sub Form_Load()
Combo1.AddItem "1"
Combo1.AddItem "2"
Combo1.AddItem "3"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -