📄 frmchaxun.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 frmchaxun
Caption = "图书库存查询界面"
ClientHeight = 5790
ClientLeft = 60
ClientTop = 345
ClientWidth = 9495
LinkTopic = "Form1"
ScaleHeight = 5790
ScaleWidth = 9495
StartUpPosition = 3 '窗口缺省
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 600
Top = 5880
Width = 5295
_ExtentX = 9340
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 1
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=MSDASQL.1;Persist Security Info=False;User ID=sa;Data Source=tshgl"
OLEDBString = "Provider=MSDASQL.1;Persist Security Info=False;User ID=sa;Data Source=tshgl"
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 = "frmchaxun.frx":0000
Height = 3015
Left = 240
TabIndex = 9
Top = 2640
Width = 9135
_ExtentX = 16113
_ExtentY = 5318
_Version = 393216
BackColor = -2147483634
HeadLines = 1
RowHeight = 15
FormatLocked = -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 = 10
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 = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column06
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 Column07
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 Column08
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 Column09
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
ColumnWidth = 1005.165
EndProperty
BeginProperty Column01
ColumnWidth = 2085.166
EndProperty
BeginProperty Column02
ColumnWidth = 1500.095
EndProperty
BeginProperty Column03
ColumnWidth = 2085.166
EndProperty
BeginProperty Column04
ColumnWidth = 1005.165
EndProperty
BeginProperty Column05
ColumnWidth = 2085.166
EndProperty
BeginProperty Column06
ColumnWidth = 1094.74
EndProperty
BeginProperty Column07
ColumnWidth = 2085.166
EndProperty
BeginProperty Column08
ColumnWidth = 2085.166
EndProperty
BeginProperty Column09
ColumnWidth = 1094.74
EndProperty
EndProperty
End
Begin VB.CommandButton cmdexit
Caption = "返回"
Height = 495
Left = 8040
Style = 1 'Graphical
TabIndex = 8
Top = 1800
Width = 1215
End
Begin VB.CommandButton cmdfind
Caption = "查询"
Default = -1 'True
Height = 495
Left = 8040
Style = 1 'Graphical
TabIndex = 7
Top = 720
Width = 1215
End
Begin VB.Frame Frame1
Height = 2175
Left = 240
TabIndex = 0
Top = 240
Width = 7455
Begin VB.TextBox txtdata
Height = 375
Left = 1680
TabIndex = 6
Top = 1200
Width = 3615
End
Begin VB.ComboBox cboOperator
Height = 300
Left = 4560
TabIndex = 5
Text = "Combo2"
Top = 360
Width = 1335
End
Begin VB.ComboBox cboFields
Height = 300
Left = 1680
TabIndex = 4
Text = "Combo1"
Top = 360
Width = 1335
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "关键字"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 240
TabIndex = 3
Top = 1200
Width = 630
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "运算符"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 3600
TabIndex = 2
Top = 480
Width = 630
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "字段名称"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 240
TabIndex = 1
Top = 360
Width = 840
End
End
End
Attribute VB_Name = "frmchaxun"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim fld
Dim rs As New ADODB.Recordset
Private Sub Cmd1_Click()
Timer1.Enabled = True
End Sub
Private Sub Form_Load()
Call main
rs.Open "select * from 书籍总表", adoCon, adOpenKeyset, adLockOptimistic
Set fld = rs.Fields
For Each fld In rs.Fields
'向combo控件中添加字段
If fld.Name = "备注" Or fld.Name = "相片" Then
Else
cboFields.AddItem fld.Name
End If
Next
rs.Close
cboFields.ListIndex = 0
'向cboOperator中添加查询条件
cboOperator.AddItem ("like")
cboOperator.AddItem (">")
cboOperator.AddItem ("=")
cboOperator.AddItem (">=")
cboOperator.AddItem ("<")
cboOperator.AddItem ("<=")
cboOperator.AddItem ("<>")
cboOperator.ListIndex = 0
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2
End Sub
Private Sub cmdFind_Click() '查询
If adoCon.State <> 0 Then
Else
Call main
End If
tb = "书籍总表"
rs.Open "select * from " & tb, adoCon, adOpenKeyset, adLockOptimistic
If cboOperator.Text = "like" Then
sql = tb & " where " & tb & "." & cboFields & " like+ '%'+'" + txtdata.Text + "'+'%'"
Else
sql = tb & " where " & tb & "." & cboFields & cboOperator & "'" + txtdata.Text + "'"
End If
sql1 = "select * from " & sql
rs.Close
adoCon.Close
Adodc1.RecordSource = sql1
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.Update
Else
MsgBox "没有找到符合条件的记录!", , "提示窗口"
End If
End Sub
Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub Form_Unload(Cancel As Integer)
If adoCon.State <> 0 Then
adoCon.Close
Else
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -