📄 book.frm
字号:
Begin VB.Label Label4
Caption = "出版社"
Height = 375
Left = 240
TabIndex = 12
Top = 2040
Width = 735
End
Begin VB.Label Label3
Caption = "作者"
Height = 255
Left = 240
TabIndex = 11
Top = 1560
Width = 975
End
Begin VB.Label Label2
Caption = "书名"
Height = 255
Left = 240
TabIndex = 10
Top = 1080
Width = 615
End
Begin VB.Label Label1
Caption = "图书编号"
Height = 375
Left = 240
TabIndex = 9
Top = 600
Width = 735
End
End
Begin MSAdodcLib.Adodc Adodc1
Height = 450
Left = 8640
Top = 5400
Width = 4440
_ExtentX = 7832
_ExtentY = 794
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 2
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=图书馆管理系统.mdb;Persist Security Info=False"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=图书馆管理系统.mdb;Persist Security Info=False"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "图书信息"
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSAdodcLib.Adodc Adodc2
Height = 5655
Left = 13560
Top = 240
Width = 1215
_ExtentX = 2143
_ExtentY = 9975
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 2
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=图书馆管理系统.mdb;Persist Security Info=False"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=图书馆管理系统.mdb;Persist Security Info=False"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "借阅数据表"
Caption = "Adodc2"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.Label Label10
AutoSize = -1 'True
Caption = "图书信息搜索"
BeginProperty Font
Name = "幼圆"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 8760
TabIndex = 27
Top = 3240
Width = 1350
End
Begin VB.Line Line2
X1 = 8520
X2 = 12480
Y1 = 3480
Y2 = 3480
End
Begin VB.Label Label9
Caption = "搜索条件"
Height = 255
Left = 8760
TabIndex = 26
Top = 3720
Width = 1095
End
End
Attribute VB_Name = "book"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
If Text1.Text <> "" And Text3.Text <> "" Then
Adodc1.Recordset.Filter = "图书编号='" & Text2.Text & "'"
If Adodc1.Recordset.EOF = True Then
Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields("图书编号") = Text1.Text
Adodc1.Recordset.Fields("书名") = Text2.Text
Adodc1.Recordset.Fields("作者") = Text3.Text
Adodc1.Recordset.Fields("出版社") = Text4.Text
Adodc1.Recordset.Fields("出版日期") = Text5.Text
Adodc1.Recordset.Fields("单价") = Text6.Text
Adodc1.Recordset.Fields("图书类别") = Text7.Text
Adodc1.Recordset.Fields("内容简介") = Text8.Text
Adodc1.Recordset.Update
Else
MsgBox "该图书已存在,不允许添加!"
End If
Else
MsgBox "图书编号不能为空!"
End If
Adodc1.Recordset.Filter = ""
Set DataGrid1.DataSource = Adodc1.Recordset
End Sub
Private Sub Command2_Click()
If Adodc1.Recordset.EOF = False Then
Adodc1.Recordset.Fields("书名") = Text2.Text
Adodc1.Recordset.Fields("作者") = Text3.Text
Adodc1.Recordset.Fields("出版社") = Text4.Text
Adodc1.Recordset.Fields("出版日期") = Text5.Text
Adodc1.Recordset.Fields("单价") = Text6.Text
Adodc1.Recordset.Fields("图书类别") = Text7.Text
Adodc1.Recordset.Fields("内容简介") = Text8.Text
Adodc1.Recordset.Update
MsgBox "修改成功"
Else
MsgBox "请选择图书"
End If
End Sub
Private Sub command3_Click()
If Adodc1.Recordset.EOF = False Then
Adodc2.Recordset.Find "图书编号'" & Text1.Text & "'"
If Adodc2.Recordset.EOF = False Then
Adodc1.Recordset.Delete
Adodc1.Recordset.MoveNext
Else
MsgBox "该图书外借,不能删除"
End If
End If
End Sub
Private Sub Command4_Click()
Adodc1.Recordset.Filter = ""
Set DataGrid1.DataSource = Adodc1.Recordset
Adodc1.Refresh
End Sub
Private Sub Command5_Click()
Adodc1.Recordset.Filter = ""
Set DataGrid1.DataSource = Adodc1.Recordset
Dim condition As String
condition = Combo2.Text & "='" & Text9.Text & "'"
Adodc1.Recordset.Filter = condition
If Adodc1.Recordset.EOF = False Then
Set DataGrid1.DataSource = Adodc1.Recordset
Else
MsgBox "没有您要找的信息"
End If
End Sub
Private Sub Command6_Click()
Text9.Text = ""
End Sub
Private Sub DataGrid1_SelChange(Cancel As Integer)
If Adodc1.Recordset.EOF = False Then
Text1.Text = Adodc1.Recordset.Fields("图书编号")
Text2.Text = Adodc1.Recordset.Fields("书名")
Text3.Text = Adodc1.Recordset.Fields("作者")
Text4.Text = Adodc1.Recordset.Fields("出版社")
Text5.Text = Adodc1.Recordset.Fields("出版日期")
Text6.Text = Adodc1.Recordset.Fields("单价")
Text7.Text = Adodc1.Recordset.Fields("图书类别")
Text8.Text = Adodc1.Recordset.Fields("内容简介")
End If
End Sub
Private Sub Form_Load()
Text1.Enabled = False
Combo2.AddItem "图书编号"
Combo2.AddItem "书名"
Combo2.AddItem "作者"
Combo2.AddItem "出版社"
Combo2.AddItem "出版日期"
Combo2.AddItem "单价"
Adodc1.Refresh
Adodc2.Refresh
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -