📄 查询.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "msflxgrd.ocx"
Begin VB.Form 查询
BorderStyle = 1 'Fixed Single
ClientHeight = 5280
ClientLeft = 2310
ClientTop = 780
ClientWidth = 6405
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 5280
ScaleWidth = 6405
Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1
Height = 2055
Left = 480
TabIndex = 7
Top = 2040
Width = 5415
_ExtentX = 9551
_ExtentY = 3625
_Version = 393216
Cols = 9
ScrollTrack = -1 'True
End
Begin VB.TextBox Text1
Height = 375
Left = 2160
TabIndex = 5
Top = 240
Width = 2895
End
Begin VB.CommandButton Command3
Caption = "确定"
Height = 495
Left = 1800
TabIndex = 4
Top = 4320
Width = 1215
End
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access"
DatabaseName = ""
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 375
Left = 4680
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = ""
Top = 1080
Visible = 0 'False
Width = 1215
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 495
Left = 3720
TabIndex = 3
Top = 4320
Width = 1215
End
Begin VB.ComboBox Combo1
Height = 300
ItemData = "查询.frx":0000
Left = 2280
List = "查询.frx":0002
TabIndex = 0
Top = 1080
Width = 1575
End
Begin VB.Label Label4
Caption = "请输入查询名称"
Height = 495
Left = 480
TabIndex = 6
Top = 360
Width = 1335
End
Begin VB.Label Label3
Caption = "您查询的结果为"
Height = 255
Left = 480
TabIndex = 2
Top = 1800
Width = 1335
End
Begin VB.Label Label2
Caption = "请选择查询类型"
Height = 495
Left = 480
TabIndex = 1
Top = 1080
Width = 1455
End
End
Attribute VB_Name = "查询"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Command3_Click()
Dim x
Dim i As Integer
x = Combo1.Text
Data1.DatabaseName = App.Path & "\图书系统.mdb"
If Text1.Text <> "" Then
Select Case x
Case "作者"
Data1.RecordSource = "select * from 图书资料 where 作者 like '*" & Trim(Text1.Text) & "*'"
Case "图书名称"
Data1.RecordSource = "select * from 图书资料 where 图书名称 like '*" & Trim(Text1.Text) & "*'"
Case "类型"
Data1.RecordSource = "select * from 图书资料 where 类型 like '*" & Trim(Text1.Text) & "*'"
Case "出版社"
Data1.RecordSource = "select * from 图书资料 where 出版社 like '*" & Trim(Text1.Text) & "*'"
End Select
Data1.Refresh
If Not Data1.Recordset.EOF Then
Data1.Recordset.MoveFirst
Do While Not Data1.Recordset.EOF
MSFlexGrid1.Rows = MSFlexGrid1.Rows + 1
i = MSFlexGrid1.Rows - 1
MSFlexGrid1.TextMatrix(i, 0) = Data1.Recordset.Fields(0)
MSFlexGrid1.TextMatrix(i, 1) = Data1.Recordset.Fields(1)
MSFlexGrid1.TextMatrix(i, 2) = Data1.Recordset.Fields(2)
MSFlexGrid1.TextMatrix(i, 3) = Data1.Recordset.Fields(3)
MSFlexGrid1.TextMatrix(i, 4) = Data1.Recordset.Fields(4)
MSFlexGrid1.TextMatrix(i, 5) = Data1.Recordset.Fields(5)
MSFlexGrid1.TextMatrix(i, 6) = Data1.Recordset.Fields(6)
MSFlexGrid1.TextMatrix(i, 7) = Data1.Recordset.Fields(8)
Data1.Recordset.MoveNext
Loop
Else
MsgBox "没有需要的信息", vbOKOnly, "消息"
End If
Else
MsgBox "请输入信息", vbOKOnly, "信息"
Text1.SetFocus
End If
End Sub
Private Sub Form_Load()
MSFlexGrid1.Rows = 1
MSFlexGrid1.Cols = 8
MSFlexGrid1.Row = MSFlexGrid1.Rows - 1
MSFlexGrid1.TextMatrix(0, 0) = "图书编号"
MSFlexGrid1.TextMatrix(0, 1) = "图书名称"
MSFlexGrid1.TextMatrix(0, 2) = "作者"
MSFlexGrid1.TextMatrix(0, 3) = "出版社"
MSFlexGrid1.TextMatrix(0, 4) = "入库时间"
MSFlexGrid1.TextMatrix(0, 5) = "类型"
MSFlexGrid1.TextMatrix(0, 6) = "状态"
MSFlexGrid1.TextMatrix(0, 7) = "价格"
Combo1.AddItem "作者"
Combo1.AddItem "图书名称"
Combo1.AddItem "类型"
Combo1.AddItem "出版社"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -