📄 addbook.frm
字号:
VERSION 5.00
Begin VB.Form addbook
Caption = "增加图书"
ClientHeight = 5055
ClientLeft = 60
ClientTop = 345
ClientWidth = 6435
LinkTopic = "Form1"
Moveable = 0 'False
ScaleHeight = 5055
ScaleWidth = 6435
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame1
Height = 4815
Left = 120
TabIndex = 0
Top = 120
Width = 6135
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access"
DatabaseName = "E:\vb实例\图书管理系统\db2.mdb"
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 405
Left = 3600
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "book"
Top = 4320
Visible = 0 'False
Width = 1575
End
Begin VB.CommandButton Command4
Caption = "取 消"
Height = 495
Left = 2520
TabIndex = 14
Top = 3840
Width = 800
End
Begin VB.CommandButton Command3
Caption = "退 出"
Default = -1 'True
Height = 495
Left = 3720
TabIndex = 15
Top = 3840
Width = 800
End
Begin VB.CommandButton Command2
Caption = "保 存"
Height = 495
Left = 1320
TabIndex = 13
Top = 3840
Width = 800
End
Begin VB.TextBox Text6
Height = 375
Left = 4200
TabIndex = 6
Top = 2880
Width = 975
End
Begin VB.TextBox Text5
Height = 375
Left = 1320
TabIndex = 5
Top = 2880
Width = 975
End
Begin VB.TextBox Text4
Height = 375
Left = 4080
TabIndex = 4
Top = 1560
Width = 1815
End
Begin VB.TextBox Text3
Height = 375
Left = 1320
TabIndex = 3
Top = 1560
Width = 1335
End
Begin VB.TextBox Text2
Height = 375
Left = 4080
TabIndex = 2
Top = 480
Width = 1575
End
Begin VB.TextBox Text1
BeginProperty DataFormat
Type = 1
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
Height = 375
Left = 1320
TabIndex = 1
Top = 480
Width = 1455
End
Begin VB.Label Label1
Alignment = 2 'Center
AutoSize = -1 'True
Caption = "书号:"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 285
Index = 0
Left = 510
TabIndex = 12
Top = 480
Width = 795
End
Begin VB.Label Label1
Alignment = 2 'Center
AutoSize = -1 'True
Caption = "作者:"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 285
Index = 2
Left = 510
TabIndex = 11
Top = 1560
Width = 795
End
Begin VB.Label Label1
Alignment = 2 'Center
AutoSize = -1 'True
Caption = "书名:"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 285
Index = 3
Left = 3150
TabIndex = 10
Top = 480
Width = 795
End
Begin VB.Label Label1
Alignment = 2 'Center
AutoSize = -1 'True
Caption = "出版社:"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 285
Index = 4
Left = 2910
TabIndex = 9
Top = 1560
Width = 1095
End
Begin VB.Label Label1
Alignment = 2 'Center
AutoSize = -1 'True
Caption = "总数:"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 285
Index = 5
Left = 510
TabIndex = 8
Top = 2880
Width = 795
End
Begin VB.Label Label1
Alignment = 2 'Center
AutoSize = -1 'True
Caption = "在库数目:"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 285
Index = 6
Left = 2760
TabIndex = 7
Top = 2880
Width = 1395
End
End
End
Attribute VB_Name = "addbook"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command2_Click()
On Error GoTo updateerr
Do
Data1.Recordset.MoveFirst
condition = "书号='" & Text1.Text & "'"
Data1.Recordset.FindFirst condition
If Data1.Recordset.NoMatch Then
BeginTrans
Data1.Recordset.Edit
Data1.Recordset.Fields("书号") = Text1.Text
Data1.Recordset.Fields("书名") = Text2.Text
Data1.Recordset.Fields("作者") = Text3.Text
Data1.Recordset.Fields("出版社") = Text4.Text
Data1.Recordset.Fields("总数") = Text5.Text
Data1.Recordset.Fields("在库数目") = Text6.Text
Data1.Recordset.Update
CommitTrans
MsgBox "增加成功"
Data1.Refresh
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Exit Sub
updateerr:
Rollback
MsgBox Err.Description
Else
MsgBox "该书号已经存在,请换书号!"
Text1.SetFocus
End If
Data1.Recordset.MoveNext
Loop Until Data1.Recordset.EOF
End Sub
Private Sub Command3_Click()
Unload addbook
End Sub
Private Sub Command4_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
addbook.Refresh
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -