📄 查询.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form 查询
Caption = "查询"
ClientHeight = 5895
ClientLeft = 60
ClientTop = 345
ClientWidth = 7980
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 5895
ScaleWidth = 7980
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox Text5
Height = 495
Left = 6480
TabIndex = 7
Top = 4320
Width = 1215
End
Begin VB.TextBox Text4
Height = 495
Left = 4920
TabIndex = 6
Top = 4320
Width = 1215
End
Begin VB.TextBox Text3
Height = 495
Left = 3360
TabIndex = 5
Top = 4320
Width = 1215
End
Begin VB.TextBox Text2
Height = 495
Left = 1800
TabIndex = 4
Top = 4320
Width = 1215
End
Begin VB.TextBox Text1
Height = 495
Left = 240
TabIndex = 3
Top = 4320
Width = 1215
End
Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1
Height = 3495
Left = 360
TabIndex = 2
Top = 240
Width = 7455
_ExtentX = 13150
_ExtentY = 6165
_Version = 393216
Rows = 100
Cols = 30
End
Begin VB.CommandButton Command2
Caption = "退出"
Height = 495
Left = 4920
TabIndex = 1
Top = 5160
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "查询"
Height = 495
Left = 1800
TabIndex = 0
Top = 5160
Width = 1215
End
Begin VB.Label Label5
Caption = "商品产地"
BeginProperty Font
Name = "华文彩云"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 6720
TabIndex = 12
Top = 3960
Width = 1215
End
Begin VB.Label Label4
Caption = "商品数量"
BeginProperty Font
Name = "华文彩云"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 855
Left = 5160
TabIndex = 11
Top = 3960
Width = 1215
End
Begin VB.Label Label3
Caption = "商品类别"
BeginProperty Font
Name = "华文彩云"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 3600
TabIndex = 10
Top = 3960
Width = 1215
End
Begin VB.Label Label2
Caption = "商品名称"
BeginProperty Font
Name = "华文彩云"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 2040
TabIndex = 9
Top = 3960
Width = 1215
End
Begin VB.Label Label1
Caption = "商品编号"
BeginProperty Font
Name = "华文彩云"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 480
TabIndex = 8
Top = 3960
Width = 1215
End
End
Attribute VB_Name = "查询"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim mrc As ADODB.Recordset
Dim a As String
Dim txtsql As String
Dim msgtext As String
Private Sub Command2_Click()
主界面.Show
Unload Me
End Sub
Private Sub Command1_Click()
Dim a
a = ""
ID = Text1.Text
商品编号 = Text1.Text
商品名称 = Text2.Text
商品类别 = Text3.Text
商品数量 = Text4.Text
商品产地 = Text5.Text
If 商品编号 <> "" Then
a = a & " AND 商品编号='" & 商品编号 & "'"
End If
If 商品名称 <> "" Then
a = a & " AND 商品名称 ='" & 商品名称 & "'"
End If
If 商品类别 <> "" Then
a = a & " AND 商品类别='" & 商品类别 & "'"
End If
If 商品数量 <> "" Then
a = a & " AND 商品数量='" & 商品数量 & "'"
End If
If 商品产地 <> "" Then
a = a & " AND 商品产地='" & 商品产地 & "'"
End If
Dim line
Dim mrc As ADODB.Recordset
If a = "" Then
txtsql = "select * from 商品基本信息表 "
Set mrc = ExecuteSQL(txtsql, msgtext)
If mrc.EOF = False Then
MsgBox "目前数据库中记录数为0。", vbOKOnly
Else
MsgBox "没有满足条件的记录!", vbOKOnly
Exit Sub
End If
End If
If a <> "" Then
a = Mid(a, 5, Len(a))
txtsql = "select * from 商品基本信息表 where " & a & " "
Set mrc = ExecuteSQL(txtsql, msgtext)
If mrc.RecordCount = 0 Then
MsgBox "没有满足条件的记录,请重新输入!", vbOKOnly
MSFlexGrid1.Clear
Exit Sub
Exit Sub
End If
MSFlexGrid1.Visible = True
line = 0
Do Until mrc.EOF
line = line + 1
With MSFlexGrid1
.Cols = 5
.TextMatrix(0, 0) = "商品编号"
.TextMatrix(0, 1) = "商品名称"
.TextMatrix(0, 2) = "商品类别"
.TextMatrix(0, 3) = "商品数量"
.TextMatrix(0, 4) = "商品产地"
.TextMatrix(line, 0) = mrc.Fields(0)
.TextMatrix(line, 1) = mrc.Fields(1)
.TextMatrix(line, 2) = mrc.Fields(2)
.TextMatrix(line, 3) = mrc.Fields(3)
.TextMatrix(line, 4) = mrc.Fields(4)
.FixedRows = 1
.ColWidth(0) = 800
.ColWidth(1) = 800
.ColWidth(2) = 800
.ColWidth(3) = 800
.ColWidth(4) = 800
End With
mrc.MoveNext
Loop
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -