📄 frmbookquery.frm
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form FrmBookQuery
Caption = "正在进行书库查询"
ClientHeight = 7980
ClientLeft = 60
ClientTop = 345
ClientWidth = 10800
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 7980
ScaleWidth = 10800
StartUpPosition = 2 '屏幕中心
Begin MSAdodcLib.Adodc Adodc1
Height = 615
Left = 7320
Top = 6480
Visible = 0 'False
Width = 1935
_ExtentX = 3413
_ExtentY = 1085
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 = ""
OLEDBString = ""
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 VB.Frame Frame1
Caption = "书库查询"
Height = 2655
Left = 120
TabIndex = 0
Top = 120
Width = 10575
Begin VB.TextBox txtBookPrice
Height = 375
Left = 5040
TabIndex = 16
Top = 840
Width = 3375
End
Begin VB.CommandButton cmdClose
Caption = "关闭"
Height = 495
Left = 9000
TabIndex = 14
Top = 1680
Width = 1215
End
Begin VB.CommandButton cmdClear
Caption = "清空"
Height = 495
Left = 9000
TabIndex = 13
Top = 1080
Width = 1215
End
Begin VB.CommandButton cmdFind
Caption = "开始查找"
Default = -1 'True
Height = 495
Left = 9000
TabIndex = 12
Top = 480
Width = 1215
End
Begin VB.CheckBox chkMoHu
Caption = "执行模糊查询"
Height = 255
Left = 240
TabIndex = 11
Top = 2280
Width = 1455
End
Begin VB.Frame Frame2
Height = 135
Left = 240
TabIndex = 10
Top = 2040
Width = 8055
End
Begin VB.CheckBox chkRigDate
Caption = "登记日期"
Height = 375
Left = 4200
TabIndex = 9
Top = 1560
Width = 1095
End
Begin VB.TextBox txtBookID
BackColor = &H00FFFFFF&
Height = 375
Left = 960
TabIndex = 3
Top = 360
Width = 3015
End
Begin VB.TextBox txtBookName
Height = 375
Left = 5040
TabIndex = 2
Top = 360
Width = 3375
End
Begin VB.ComboBox cboType
Height = 300
Left = 960
TabIndex = 1
Top = 960
Width = 3015
End
Begin MSComCtl2.DTPicker dtpRigDate
Height = 375
Left = 5400
TabIndex = 8
Top = 1560
Width = 2415
_ExtentX = 4260
_ExtentY = 661
_Version = 393216
Enabled = 0 'False
Format = 22216705
CurrentDate = 37828
End
Begin VB.Label Label27
Caption = "书籍编号:"
Height = 255
Left = 120
TabIndex = 7
Top = 480
Width = 975
End
Begin VB.Label Label25
Caption = "书籍名称:"
Height = 255
Left = 4080
TabIndex = 6
Top = 480
Width = 975
End
Begin VB.Label Label24
Caption = "书籍类别:"
Height = 255
Left = 120
TabIndex = 5
Top = 1080
Width = 855
End
Begin VB.Label Label26
Caption = "书籍价格:"
Height = 255
Left = 4080
TabIndex = 4
Top = 960
Width = 855
End
End
Begin MSDataGridLib.DataGrid DataGrid1
Bindings = "FrmBookQuery.frx":0000
Height = 4935
Left = 120
TabIndex = 15
Top = 2880
Width = 10695
_ExtentX = 18865
_ExtentY = 8705
_Version = 393216
AllowUpdate = 0 'False
AllowArrows = 0 'False
Enabled = -1 'True
HeadLines = 1
RowHeight = 15
FormatLocked = -1 'True
AllowDelete = -1 'True
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 = 6
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
BeginProperty Column02
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 Column03
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 Column04
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 Column05
DataField = "是否借出"
Caption = "是否借出"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 5
Format = ""
HaveTrueFalseNull= 1
TrueValue = "是"
FalseValue = "否"
NullValue = ""
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
Locked = -1 'True
ColumnWidth = 1005.165
EndProperty
BeginProperty Column01
ColumnWidth = 1904.882
EndProperty
BeginProperty Column02
ColumnWidth = 854.929
EndProperty
BeginProperty Column03
ColumnWidth = 900.284
EndProperty
BeginProperty Column04
ColumnWidth = 1019.906
EndProperty
BeginProperty Column05
ColumnWidth = 929.764
EndProperty
EndProperty
End
End
Attribute VB_Name = "FrmBookQuery"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Check1_Click()
End Sub
Private Sub chkRigDate_Click()
If chkRigDate.Value = 1 Then
dtpRigDate.Enabled = True
Else
dtpRigDate.Enabled = False
End If
End Sub
Private Sub cmdClear_Click()
txtBookID.Text = ""
txtBookName.Text = ""
cboType.Text = ""
txtBookPrice.Text = ""
End Sub
Private Sub cmdClose_Click()
Unload Me
End Sub
Private Sub cmdFind_Click()
Dim strSQL As String
Dim strCon(6) As String
Dim intCount As Integer
Dim i As Integer
intCount = 0
'获得所有得查询条件
If txtBookID.Text <> "" Then
If chkMoHu.Value = 1 Then
strCon(1) = "书籍编号 like '%" & txtBookID.Text & "%'"
Else
strCon(1) = "书籍编号='" & txtBookID.Text & "'"
End If
Else
strCon(1) = ""
End If
If txtBookName.Text <> "" Then
If chkMoHu.Value = 1 Then
strCon(2) = "书籍名称 like '%" & txtBookName.Text & "%'"
Else
strCon(2) = "书籍名称='" & txtBookName.Text & "'"
End If
Else
strCon(2) = ""
End If
If cboType.Text <> "" Then
If chkMoHu.Value = 1 Then
strCon(3) = "类别代码 like '%" & Mid(cboType.Text, 1, 1) & "%'"
Else
strCon(3) = "类别代码='" & Mid(cboType.Text, 1, 1) & "'"
End If
Else
strCon(3) = ""
End If
If txtBookPrice.Text <> "" Then
If chkMoHu.Value = 1 Then
strCon(5) = "书籍价格 like %" & CInt(txtBookPrice.Text) & "%"
Else
strCon(5) = "书籍价格=" & CInt(txtBookPrice.Text) & ""
End If
Else
strCon(5) = ""
End If
If chkRigDate.Value = 1 Then
If chkMoHu.Value = 1 Then
strCon(6) = "登记日期 like #" & dtpRigDate.Value & "#"
Else
strCon(6) = "登记日期=#" & dtpRigDate.Value & "#"
End If
Else
strCon(6) = ""
End If
If strCon(1) = "" And strCon(2) = "" And strCon(3) = "" And strCon(4) = "" And strCon(5) = "" And strCon(6) = "" Then
strSQL = "select * from bookInfo"
Else
strSQL = "select * from bookInfo where "
For i = 1 To 6
If strCon(i) <> "" Then
intCount = intCount + 1
If intCount = 1 Then
strSQL = strSQL + strCon(i)
Else
strSQL = strSQL + " and " + strCon(i)
End If
End If
Next
End If
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\图书馆查询管理系统.mdb;Persist Security Info=False"
Adodc1.CursorLocation = adUseClient
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = strSQL
Adodc1.Refresh
End Sub
Private Sub Form_Load()
dtpRigDate.Value = Date
Set g_rs = g_db.OpenRecordset("bookType", dbOpenTable)
cboType.Clear
If g_rs.RecordCount > 0 Then
g_rs.MoveFirst
Do While Not g_rs.EOF
cboType.AddItem g_rs!类别代码 + "-" + g_rs!书籍类别
g_rs.MoveNext
Loop
End If
Set g_rs = Nothing
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -