📄 添加用户.frm
字号:
VERSION 5.00
Begin VB.Form 添加用户
Caption = "添加用户"
ClientHeight = 3495
ClientLeft = 60
ClientTop = 450
ClientWidth = 5775
LinkTopic = "Form1"
ScaleHeight = 3495
ScaleWidth = 5775
StartUpPosition = 1 '所有者中心
Begin VB.ComboBox Combo2
Height = 315
Left = 2160
TabIndex = 11
Text = "男"
Top = 1240
Width = 1095
End
Begin VB.ComboBox Combo1
Height = 315
Left = 2160
TabIndex = 10
Text = "学生"
Top = 2200
Width = 1095
End
Begin VB.CommandButton Command2
Caption = "返回"
Height = 375
Left = 4200
TabIndex = 9
Top = 2520
Width = 975
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 375
Left = 4200
TabIndex = 8
Top = 1440
Width = 975
End
Begin VB.TextBox Text4
Height = 285
Left = 2160
TabIndex = 6
Text = "信息学院"
Top = 1720
Width = 1095
End
Begin VB.TextBox Text2
Height = 285
Left = 2160
TabIndex = 5
Text = "张三"
Top = 760
Width = 1095
End
Begin VB.TextBox Text1
Height = 285
Left = 2160
TabIndex = 4
Text = "000010"
Top = 280
Width = 1095
End
Begin VB.Label Label5
Caption = "用户类型:"
Height = 255
Left = 600
TabIndex = 7
Top = 2280
Width = 1215
End
Begin VB.Label Label4
Caption = "院系:"
Height = 255
Left = 600
TabIndex = 3
Top = 1800
Width = 1215
End
Begin VB.Label Label3
Caption = "性别:"
Height = 255
Left = 600
TabIndex = 2
Top = 1320
Width = 1215
End
Begin VB.Label Label2
Caption = "姓名:"
Height = 255
Left = 600
TabIndex = 1
Top = 840
Width = 1215
End
Begin VB.Label Label1
Caption = "借书证号:"
Height = 255
Left = 600
TabIndex = 0
Top = 360
Width = 1215
End
End
Attribute VB_Name = "添加用户"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim usertype As Integer
Private Sub Combo1_Click()
If Combo1.Text = 学生 Then
usertype = 2
Else: usertype = 1
End If
End Sub
Private Sub Command1_Click()
Dim Error_num As Integer
If Text1.Text = "" Or Text2.Text = "" Or Text4.Text = "" Then
MsgBox "数据输入不完整,请完成输入!", vbOKOnly, "输入错误!"
Exit Sub
End If
Mycom.ActiveConnection = Mycon
Mycom.CommandType = adCmdStoredProc
Mycom.CommandText = "添加用户"
Mycom.Parameters(1) = 0
Mycom.Parameters(2) = Text1.Text
Mycom.Parameters(3) = Text2.Text
Mycom.Parameters(4) = Combo2.Text
Mycom.Parameters(5) = Text4.Text
Mycom.Parameters(6) = usertype
Mycom.Execute
Error_num = Mycom.Parameters(1)
If Error_num = 2 Then
MsgBox "该借书证号已存在!请重新输入!"
Text1.Text = ""
Else
MsgBox "该用户信息已成功添加到“用户信息”表中!", vbOKOnly, "添加成功!"
End If
Set Mycom = Nothing
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Me.Show
usertype = 2
Combo1.AddItem ("学生")
Combo1.AddItem ("老师")
Combo2.AddItem ("男")
Combo2.AddItem ("女")
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -