📄 frmqueuebook.frm
字号:
VERSION 5.00
Begin VB.Form frmQueueBook
BackColor = &H80000013&
Caption = "图书查询"
ClientHeight = 3480
ClientLeft = 4665
ClientTop = 5145
ClientWidth = 5310
LinkTopic = "Form1"
ScaleHeight = 3480
ScaleWidth = 5310
Begin VB.CheckBox chk_zz
BackColor = &H80000013&
Height = 255
Left = 4440
TabIndex = 11
Top = 2160
Width = 255
End
Begin VB.CheckBox chk_tsmc
BackColor = &H80000013&
Height = 255
Left = 4440
TabIndex = 10
Top = 1560
Width = 255
End
Begin VB.CheckBox chk_tsbh
BackColor = &H80000013&
Height = 255
Left = 4440
TabIndex = 9
Top = 960
Width = 255
End
Begin VB.CommandButton cmdReturn
Caption = "返回"
Height = 375
Left = 2640
TabIndex = 8
Top = 2880
Width = 975
End
Begin VB.CommandButton cmdQueue
Caption = "查询"
Height = 375
Left = 1320
TabIndex = 7
Top = 2880
Width = 975
End
Begin VB.TextBox zz
Height = 375
Left = 1440
TabIndex = 6
Top = 2160
Width = 2895
End
Begin VB.TextBox tsmc
Height = 375
Left = 1440
TabIndex = 5
Top = 1560
Width = 2895
End
Begin VB.TextBox tsbh
Height = 375
Left = 1440
TabIndex = 4
Top = 960
Width = 2895
End
Begin VB.Label Label4
BackColor = &H80000013&
Caption = "作 者:"
Height = 375
Left = 360
TabIndex = 3
Top = 2280
Width = 975
End
Begin VB.Label Label3
BackColor = &H80000013&
Caption = "图书名称:"
Height = 375
Left = 360
TabIndex = 2
Top = 1680
Width = 1095
End
Begin VB.Label Label2
BackColor = &H80000013&
Caption = "图书编号:"
Height = 255
Left = 360
TabIndex = 1
Top = 1080
Width = 1095
End
Begin VB.Label Label1
BackColor = &H80000013&
Caption = "查询图书信息"
BeginProperty Font
Name = "隶书"
Size = 21.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1080
TabIndex = 0
Top = 120
Width = 2895
End
End
Attribute VB_Name = "frmQueueBook"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'****************************************************************************
' 作者:林永刚
' 名称:frmQueueBook
' 功能:对图书信息进行查询。
'****************************************************************************
Private Sub cmdqueue_Click()
Dim rs As New ADODB.Recordset
Dim sql As String
Dim sz(3) As Boolean
Dim i As Integer
For i = 0 To 3 - 1 Step 1
sz(i) = False
Next i
sql = "select * from books where "
'判断是否选择按编号查询
If chk_tsbh.Value = 1 Then
If Trim(tsbh.Text) = "" Then
MsgBox "图书编号不能为空!", vbOKOnly + vbExclamation, "警告"
tsbh.SetFocus
Exit Sub
Else
sz(0) = True
'组合查询语句
sql = sql & " tsbh like '" & Trim(tsbh.Text) & "%'"
End If
End If
'判断是否按书名查询
If chk_tsmc.Value = 1 Then
If Trim(tsmc.Text) = "" Then
MsgBox "图书名称不能为空!", vbOKOnly + vbExclamation, "警告"
txt图书名称.SetFocus
Exit Sub
Else
sz(1) = True
If sz(0) Then
'组和查询语句
sql = sql & " and tsmc like '" & Trim(tsmc.Text) & "%'"
Else
sql = sql & " tsmc like'" & Trim(tsmc.Text) & "%'"
End If
End If
End If
'判断是否选择按作者查询
If chk_zz.Value = 1 Then
If Trim(zz.Text) = "" Then
MsgBox "作者不能为空!", vbOKOnly + vbExclamation, "警告"
zz.SetFocus
Exit Sub
Else
sz(2) = True
If sz(0) Or sz(1) Then
'组合查询语句
sql = sql & "and zz like'" & Trim(zz.Text) & "%'"
Else
sql = sql & " zz like'" & Trim(zz.Text) & "%'"
End If
End If
End If
'判断是否设置查询方式
If (sz(0) Or sz(1) Or sz(2)) = False Then
MsgBox "请设置查询方式!", vbOKOnly + vbExclamation, "警告"
Exit Sub
End If
'查询所有满足条件的内容
sql = sql & " order by tsbh"
Set rs = ADOSQL(sql)
If rs.EOF = True Then
MsgBox "没有找到要查询的信息", vbOKOnly
Else
With frmBooksInfo.bookGrid
.Rows = 1
Do While Not rs.EOF
.Rows = .Rows + 1
.TextMatrix(.Rows - 1, 0) = rs(0)
.TextMatrix(.Rows - 1, 1) = rs(1)
.TextMatrix(.Rows - 1, 2) = rs(2)
.TextMatrix(.Rows - 1, 3) = rs(3)
.TextMatrix(.Rows - 1, 4) = rs(4)
.TextMatrix(.Rows - 1, 5) = rs(5)
.TextMatrix(.Rows - 1, 6) = rs(6)
.TextMatrix(.Rows - 1, 7) = rs(7)
.TextMatrix(.Rows - 1, 8) = rs(8)
.TextMatrix(.Rows - 1, 9) = rs(9)
.TextMatrix(.Rows - 1, 10) = rs(10)
.TextMatrix(.Rows - 1, 11) = rs(11)
.TextMatrix(.Rows - 1, 12) = rs(12)
.TextMatrix(.Rows - 1, 13) = rs(13)
.TextMatrix(.Rows - 1, 14) = rs(14)
.TextMatrix(.Rows - 1, 15) = rs(15)
.TextMatrix(.Rows - 1, 16) = rs(16)
.TextMatrix(.Rows - 1, 17) = rs(17)
.TextMatrix(.Rows - 1, 18) = rs(18)
rs.MoveNext
Loop
End With
Unload Me
End If
rs.Close
End Sub
Private Sub cmdReturn_Click()
Unload Me
End Sub
Private Sub Form_Unload(Cancel As Integer)
frmBooksInfo.Show
frmBooksInfo.SetFocus
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -