📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Addreader
BorderStyle = 1 'Fixed Single
Caption = "添加读者"
ClientHeight = 5775
ClientLeft = 4965
ClientTop = 3165
ClientWidth = 5880
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
ScaleHeight = 5775
ScaleWidth = 5880
Begin VB.CommandButton Command2
Caption = "关闭(&C)"
Height = 375
Left = 3960
TabIndex = 14
Top = 5160
Width = 1815
End
Begin VB.CommandButton Command1
Caption = "保存(&S)"
Height = 375
Left = 120
TabIndex = 13
Top = 5160
Width = 1695
End
Begin VB.Frame Frame1
Caption = "读者基本信息"
Height = 4815
Left = 120
TabIndex = 0
Top = 120
Width = 5655
Begin VB.TextBox Text4
BackColor = &H00C0FFFF&
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3960
TabIndex = 6
Top = 1080
Width = 1455
End
Begin VB.TextBox Text6
BackColor = &H00C0FFFF&
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 390
Left = 1320
TabIndex = 10
Top = 2760
Width = 2175
End
Begin VB.TextBox Text5
BackColor = &H00C0FFFF&
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1320
TabIndex = 12
Top = 3600
Width = 2175
End
Begin VB.TextBox Text3
BackColor = &H00C0FFFF&
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1320
TabIndex = 8
Top = 1920
Width = 1815
End
Begin VB.TextBox Text2
BackColor = &H00C0FFFF&
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1320
TabIndex = 4
Top = 1080
Width = 1455
End
Begin VB.TextBox Text1
BackColor = &H00C0FFFF&
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1320
TabIndex = 2
Top = 360
Width = 2775
End
Begin VB.Label Label8
BackStyle = 0 'Transparent
Caption = "格式:(XXXX-X-X)"
Height = 255
Left = 3600
TabIndex = 15
Top = 2880
Width = 2055
End
Begin VB.Label Label7
Caption = "办证日期"
Height = 255
Left = 360
TabIndex = 9
Top = 2880
Width = 855
End
Begin VB.Label Label6
Caption = "有效年限"
Height = 255
Left = 360
TabIndex = 11
Top = 3720
Width = 855
End
Begin VB.Label Label4
Caption = "班 级"
Height = 255
Left = 360
TabIndex = 7
Top = 2040
Width = 855
End
Begin VB.Label Label3
Caption = "性 别"
Height = 255
Left = 3000
TabIndex = 5
Top = 1200
Width = 735
End
Begin VB.Label Label2
Caption = "姓 名"
Height = 375
Left = 360
TabIndex = 3
Top = 1200
Width = 735
End
Begin VB.Label Label1
Caption = "读者编号"
Height = 375
Left = 360
TabIndex = 1
Top = 480
Width = 855
End
End
End
Attribute VB_Name = "Addreader"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim InsertStr As String '定义变量接受用户添加信息的值
'向学生基本信息表添加文本框中输入的信息
InsertStr = "INSERT INTO 学生基本信息表 VALUES('" & Text1.Text & "','" & Text2.Text & "','" & Text3.Text & "','" & Text4.Text & "','" & Text5.Text & "')"
On Error GoTo errhander '添加程序错误时执行errhander
'输入信息正确时执行
Mycon.BeginTrans
Mycon.Execute (InsertStr)
Mycon.CommitTrans
MsgBox "添加成功" '添加成功时给出提示
'添加成功后将文本框内容清空
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Exit Sub '强制退出
errhander:
MsgBox "添加失败" '错误时给出提示
Mycon.RollbackTrans
End Sub
Private Sub Command2_Click() '退出按钮
Unload Me '回到主菜单
End Sub
Private Sub Label8_Click()
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -