📄 frmbookinfo.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form frmbookinfo
Caption = "book_check"
ClientHeight = 6225
ClientLeft = 60
ClientTop = 390
ClientWidth = 8730
LinkTopic = "Form2"
ScaleHeight = 6225
ScaleWidth = 8730
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox Text4
Height = 495
Left = 4320
TabIndex = 13
Top = 360
Width = 2175
End
Begin VB.TextBox Text3
Height = 495
Left = 4320
TabIndex = 12
Top = 1080
Width = 2175
End
Begin VB.TextBox Text2
Height = 495
Left = 1440
TabIndex = 11
Top = 1560
Width = 1215
End
Begin VB.TextBox Text1
Height = 375
Left = 1440
TabIndex = 10
Top = 240
Width = 1215
End
Begin VB.ComboBox Combo1
Height = 300
Left = 1440
TabIndex = 9
Text = "选择类别"
Top = 960
Width = 1215
End
Begin VB.CheckBox Check5
Caption = "编号"
Height = 495
Left = 3240
TabIndex = 8
Top = 360
Width = 975
End
Begin VB.CheckBox Check4
Caption = "出版社"
Height = 375
Left = 3240
TabIndex = 7
Top = 1200
Width = 975
End
Begin VB.CheckBox Check3
Caption = "作者"
Height = 375
Left = 360
TabIndex = 6
Top = 1560
Width = 975
End
Begin VB.CheckBox Check2
Caption = "图书类别"
Height = 495
Left = 360
TabIndex = 5
Top = 840
Width = 1095
End
Begin VB.CheckBox Check1
Caption = "书名"
Height = 495
Left = 360
TabIndex = 4
Top = 120
Width = 1215
End
Begin VB.CommandButton Command3
Caption = "借书"
Height = 495
Left = 6960
TabIndex = 3
Top = 1560
Width = 1335
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 495
Left = 6960
TabIndex = 2
Top = 960
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 495
Left = 6960
TabIndex = 1
Top = 360
Width = 1335
End
Begin MSAdodcLib.Adodc Adodc2
Height = 375
Left = 3360
Top = 1800
Width = 2295
_ExtentX = 4048
_ExtentY = 661
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=D:\数据库\tushuguan\图书类别表.mdb;Persist Security Info=False"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\数据库\tushuguan\图书类别表.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 MSAdodcLib.Adodc Adodc1
Height = 375
Left = 480
Top = 5760
Width = 8055
_ExtentX = 14208
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
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=D:\数据库\tushuguan\书籍信息表.mdb;Persist Security Info=False"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\数据库\tushuguan\书籍信息表.mdb;Persist Security Info=False"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "select * from 书籍信息表"
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 MSDataGridLib.DataGrid DataGrid1
Bindings = "frmbookinfo.frx":0000
Height = 3375
Left = 480
TabIndex = 0
Top = 2280
Width = 8055
_ExtentX = 14208
_ExtentY = 5953
_Version = 393216
HeadLines = 1
RowHeight = 15
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
End
Attribute VB_Name = "frmbookinfo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim panduan As String
Private Sub Command1_Click()
Dim rs_findbook As New ADODB.Recordset
Dim conn As New ADODB.Connection
Dim sql As String
If Check1.Value = vbChecked Then
sql = "书名='" & Trim(Text1.Text & "") & "'"
End If
If Check2.Value = vbChecked Then
If Trim(sql) = "" Then
sql = "类别='" & Trim(Combo1.Text & " ") & "'"
Else
sql = sql & "and 类别='" & Trim(Combo1.Text & " ") & "'"
End If
End If
If Check3.Value = vbChecked Then
If Trim(sql) = "" Then
sql = "作者='" & Trim(Text2.Text & " ") & "'"
Else
sql = sql & "and 作者='" & Trim(Text2.Text & " ") & "'"
End If
End If
If Check4.Value = vbChecked Then
If Trim(sql) = "" Then
sql = "图书编号='" & Trim(Text3.Text & " ") & "'"
Else
sql = sql & "and 图书编号='" & Trim(Text3.Text & " ") & "'"
End If
End If
If Check5.Value = vbChecked Then
If Trim(sql) = "" Then
sql = "出版社='" & Trim(Text4.Text & " ") & "'"
Else
sql = sql & "and 出版社='" & Trim(Text4.Text & " ") & "'"
End If
End If
conn.Open "provider=Microsoft.Jet.OLEDB.4.0; data source=" & App.Path & "\database1.mdb"
If Trim(sql) = "" Then
MsgBox "请选择查询方式!", vbOKOnly + vbExclamation
Exit Sub
End If
sql = "select * from 书籍信息表 where " & sql
rs_findbook.CursorLocation = adUseClient
rs_findbook.Open sql, conn, adOpenKeyset, adLockPessimistic
DataGrid1.AllowAddNew = False
DataGrid1.AllowDelete = False
DataGrid1.AllowUpdate = False
If rs_findbook.RecordCount = 0 Then
MsgBox "查询不到该图书信息!", vbOKOnly + vbExclamation
Else
Set DataGrid1.DataSource = rs_findbook
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Command3_Click()
If Trim(book_num) = "" Then
MsgBox "请选择要借阅的图书!", vbOKOnly + vbExclamation
Exit Sub
End If
If panduan = "是" Then
MsgBox "此书已被借出!", vbOKOnly + vbExclamation
Exit Sub
End If
Unload Me
lendbookmanage.Show
End Sub
Private Sub DataGrid1_RowColChange(LastRow As Variant, ByVal LastCol As Integer)
book_num = DataGrid1.Columns(0).CellValue(DataGrid1.Bookmark)
panduan = DataGrid1.Columns(1).CellValue(DataGrid1.Bookmark)
End Sub
Private Sub Form_Load()
Dim rs_find As New ADODB.Recordset
Dim conn As New ADODB.Connection
Dim sql As String
sql = "select * from 图书类别表"
conn.Open "provider=Microsoft.Jet.OLEDB.4.0; data source=" & App.Path & "\database1.mdb"
rs_find.Open sql, conn, adOpenKeyset, adLockPessimistic
rs_find.MoveFirst
If Not rs_find.EOF Then
Do While Not rs_find.EOF
Combo1.AddItem rs_find.Fields(0)
rs_find.MoveNext
Loop
Combo1.ListIndex = 0
End If
rs_find.Close
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -