📄 frmbookquery.frm
字号:
VERSION 5.00
Begin VB.Form frmbookquery
BorderStyle = 3 'Fixed Dialog
Caption = "图书资料查询"
ClientHeight = 3825
ClientLeft = 45
ClientTop = 330
ClientWidth = 6105
Icon = "frmbookquery.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 3825
ScaleWidth = 6105
ShowInTaskbar = 0 'False
Begin VB.ComboBox Cbotypes
Height = 300
Left = 1560
Style = 2 'Dropdown List
TabIndex = 11
Top = 2160
Width = 1215
End
Begin VB.TextBox Txtpublish
Height = 315
Left = 1560
TabIndex = 10
Top = 2760
Width = 2175
End
Begin VB.TextBox Txtauthor
Height = 315
Left = 1560
TabIndex = 9
Top = 1440
Width = 2175
End
Begin VB.TextBox Txtbookname
Height = 315
Left = 1560
TabIndex = 8
Top = 840
Width = 3255
End
Begin VB.TextBox Txtbookindex
Height = 315
Left = 1560
TabIndex = 7
Top = 240
Width = 2175
End
Begin VB.CommandButton Cmdcancel
Caption = "取消"
Height = 375
Left = 4920
TabIndex = 1
Top = 3360
Width = 975
End
Begin VB.CommandButton Cmdok
Caption = "确定"
Height = 375
Left = 3480
TabIndex = 0
Top = 3360
Width = 975
End
Begin VB.Label Lblpublish
AutoSize = -1 'True
Caption = "出版社名称包含"
Height = 180
Left = 240
TabIndex = 6
Top = 2880
Width = 1260
End
Begin VB.Label Lblauthor
AutoSize = -1 'True
Caption = "作者姓名包含"
Height = 180
Left = 240
TabIndex = 5
Top = 1560
Width = 1080
End
Begin VB.Label Lbltypes
AutoSize = -1 'True
Caption = "图书类别"
Height = 180
Left = 240
TabIndex = 4
Top = 2280
Width = 720
End
Begin VB.Label Lblbookname
AutoSize = -1 'True
Caption = "图书名称包含"
Height = 180
Left = 240
TabIndex = 3
Top = 960
Width = 1080
End
Begin VB.Label Lblbookindex
AutoSize = -1 'True
Caption = "图书编号包含"
Height = 180
Left = 240
TabIndex = 2
Top = 360
Width = 1080
End
End
Attribute VB_Name = "frmbookquery"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Cmdcancel_Click()
Unload Me
End Sub
Private Sub Form_Load()
'窗体加载时,自动生成的数据
Cbotypes.Clear
Cbotypes.AddItem ""
Cbotypes.AddItem "报纸"
Cbotypes.AddItem "图书"
Cbotypes.AddItem "杂志"
Cbotypes.ListIndex = 0
End Sub
Private Sub Cmdok_Click()
Dim strSQL As String
strSQL = "select * from bookmessage where"
Dim s1 As String, s2 As String, s3 As String, s4 As String, s5 As String
'判断查询资料是否为空,如果为空,则查询所有的资料
If Txtbookindex.Text = "" And Txtbookname.Text = "" And Txtauthor.Text = "" And Cbotypes.Text = "" And Txtpublish.Text = "" Then
If MsgBox("是查所有图书的资料吗?", vbInformation + vbYesNo, "图书资料查询") = vbYes Then
strSQL = "select * from bookmessage"
Else
MsgBox "请输入一些图书的基本资料", vbInformation + vbOKOnly, "图书资料查询"
End If
End If
'图书编号不为空时的查询语句
If Trim(Txtbookindex.Text) <> "" Then
s1 = "(bookindex like '%" & Trim(Txtbookindex.Text) & "%')"
strSQL = strSQL & s1
If Trim(Txtbookname.Text) <> "" Then
s2 = "and(bookname like '%" & Trim(Txtbookname.Text) & "%')"
strSQL = strSQL & s2
If Trim(Txtauthor.Text) <> "" Then
s3 = "and(author like '%" & Trim(Txtauthor.Text) & "%')"
strSQL = strSQL & s3
If Cbotypes.Text <> "" Then
s4 = "and(types like '%" & Cbotypes.Text & "%')"
strSQL = strSQL & s4
If Trim(Txtpublish.Text) <> "" Then
s5 = "and(publish like '%" & Trim(Txtpublish.Text) & "%')"
strSQL = strSQL & s5
End If
End If
End If
End If
'图书编号为空,图书名不为空时的查询语句
ElseIf Trim(Txtbookname.Text) <> "" Then
s2 = "(bookname like '%" & Trim(Txtbookname.Text) & "%')"
strSQL = strSQL & s2
If Trim(Txtauthor.Text) <> "" Then
s3 = "and(author like '%" & Trim(Txtauthor.Text) & "%')"
strSQL = strSQL & s3
If Cbotypes.Text <> "" Then
s4 = "and(types like '%" & Cbotypes.Text & "%')"
strSQL = strSQL & s4
If Trim(Txtpublish.Text) <> "" Then
s5 = "and(publish like '%" & Trim(Txtpublish.Text) & "%')"
strSQL = strSQL & s5
End If
End If
End If
'图书编号,图书名为空,作者不为空时的查询语句
ElseIf Trim(Txtauthor.Text) <> "" Then
s3 = "(Author like '%" & Trim(Txtauthor.Text) & "%')"
strSQL = strSQL & s3
If Cbotypes.Text <> "" Then
s4 = "and(types like '%" & Cbotypes.Text & "%')"
strSQL = strSQL & s4
If Trim(Txtpublish.Text) <> "" Then
s5 = "and(publish like '%" & Trim(Txtpublish.Text) & "%')"
strSQL = strSQL & s5
End If
End If
'图书编号,图书名,作者为空,类型不为空时的查询语句
ElseIf Cbotypes.Text <> "" Then
s4 = "(types like '%" & Cbotypes.Text & "%')"
strSQL = strSQL & s4
If Trim(Txtpublish.Text) <> "" Then
s5 = "and(publish like '%" & Trim(Txtpublish.Text) & "%')"
strSQL = strSQL & s5
End If
'图书编号,图书名,作者,类型为空,出版社不为空时的查询语句
ElseIf Trim(Txtpublish.Text) <> "" Then
s5 = "(publish like '%" & Trim(Txtpublish.Text) & "%')"
strSQL = strSQL & s5
End If
'调用模块中的函数
If QueryEmpInfo(strSQL) = True Then
If g_DBRct.EOF And g_DBRct.BOF Then
If MsgBox("输入的图书信息错误,还要查吗?", vbInformation + vbYesNo, "错误的信息") = vbYes Then
Txtbookindex.Text = ""
Txtbookname.Text = ""
Txtauthor.Text = ""
Txtpublish.Text = ""
End If
Else
Unload Me
FrmBookSelect.Show
End If
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -