📄 form10.frm
字号:
VERSION 5.00
Begin VB.Form Form10
Caption = " 添加用户"
ClientHeight = 5760
ClientLeft = 3945
ClientTop = 2205
ClientWidth = 6315
LinkTopic = "Form10"
Picture = "Form10.frx":0000
ScaleHeight = 5760
ScaleWidth = 6315
Begin VB.TextBox Text1
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1440
TabIndex = 7
Top = 1080
Width = 1455
End
Begin VB.TextBox Text2
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1440
TabIndex = 6
Top = 360
Width = 1455
End
Begin VB.TextBox Text3
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1440
TabIndex = 5
Top = 1800
Width = 1455
End
Begin VB.TextBox Text4
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
IMEMode = 3 'DISABLE
Left = 1440
PasswordChar = "*"
TabIndex = 4
Top = 4080
Width = 1575
End
Begin VB.ComboBox Combo1
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
ItemData = "Form10.frx":20FE
Left = 1440
List = "Form10.frx":2108
TabIndex = 3
Top = 2640
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "确定"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 5160
TabIndex = 2
Top = 4440
Width = 975
End
Begin VB.CommandButton Command2
Caption = "取消"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 5160
TabIndex = 1
Top = 5040
Width = 975
End
Begin VB.ComboBox Combo2
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
ItemData = "Form10.frx":2114
Left = 1440
List = "Form10.frx":211E
TabIndex = 0
Top = 3360
Width = 1215
End
Begin VB.Label Label7
BackStyle = 0 'Transparent
Caption = "(查看是否可用?)"
Height = 255
Left = 3240
TabIndex = 14
Top = 1200
Width = 2175
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "员工编号:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 360
TabIndex = 13
Top = 480
Width = 1095
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "员工姓名:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 360
TabIndex = 12
Top = 1200
Width = 1095
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "身份证号:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 360
TabIndex = 11
Top = 1920
Width = 1095
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
Caption = "员工性别:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 360
TabIndex = 10
Top = 2640
Width = 1095
End
Begin VB.Label Label5
BackStyle = 0 'Transparent
Caption = "登录密码:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 360
TabIndex = 9
Top = 4080
Width = 1215
End
Begin VB.Label Label6
BackStyle = 0 'Transparent
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 = 8
Top = 3360
Width = 735
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()
Dim worker As New ADODB.Recordset
Dim sql As String
If Text1.Text = "" Then
MsgBox "请输入员工编号!", vbOKOnly + vbExclamation, "警告!"
Text1.SetFocus
Else
If Text2.Text = "" Then
MsgBox "请输入员工密码!", vbOKOnly + vbExclamation, "警告!"
Text2.SetFocus
Else
If Text3.Text = "" Then
MsgBox "请输入身份证号!", vbOKOnly + vbExclamation, "警告!"
Text3.SetFocus
Else
If Combo1.Text <> "男" And Combo2.Text <> "女" Then
MsgBox "请选择性别!", vbOKOnly + vbExclamation, "警告!"
Combo1.SetFocus
Else
If Text4.Text = "" Then
MsgBox "请输入您的密码!", vbOKOnly + vbExclamation, "警告!"
Text4.SetFocus
Else
If Combo2.Text <> "管理员" And Combo2.Text <> "员工" Then
MsgBox "please input the power!", vbOKOnly + vbExclamation, "警告!"
Combo2.SetFocus
Else
sql = "select * from 管理员"
worker.Open sql, con, adOpenKeyset, adLockPessimistic
worker.AddNew
worker.Fields(0) = Text1.Text
worker.Fields(1) = Text2.Text
worker.Fields(2) = Text3.Text
worker.Fields(3) = Combo1.Text
worker.Fields(4) = Text4.Text
worker.Fields(5) = Combo2.Text
worker.Update
MsgBox "用户添加成功!", vbOKOnly + vbExclamation, "恭喜!"
Me.Hide
End If
End If
End If
End If
End If
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Label7_Click()
Dim rs As New ADODB.Recordset
Dim sql As String
Dim p As Integer
sql = "select * from 管理员"
rs.Open sql, con, adOpenKeyset, adLockPessimistic
rs.MoveFirst
p = 0
Do While Not rs.EOF
If Text1.Text = rs.Fields(1) Then
p = 1
End If
rs.MoveNext
Loop
rs.Close
If p = 1 Then
MsgBox "该姓名已被注册!", vbOKOnly + vbExclamation, "警告!"
Text1.SetFocus
Else
MsgBox "该姓名未注册,可用!", vbOKOnly + vbExclamation, "恭喜!"
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -