📄 querystbad.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form querystbad
Caption = "Form1"
ClientHeight = 8595
ClientLeft = 60
ClientTop = 345
ClientWidth = 11025
LinkTopic = "Form1"
MDIChild = -1 'True
ScaleHeight = 8595
ScaleWidth = 11025
Begin VB.TextBox Text1
Height = 375
Left = 9600
TabIndex = 14
Text = "Text1"
Top = 1440
Width = 1335
End
Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1
Height = 6255
Left = 480
TabIndex = 12
Top = 2040
Width = 10455
_ExtentX = 18441
_ExtentY = 11033
_Version = 393216
ForeColor = 16711680
End
Begin VB.CommandButton Command4
Caption = "关闭(&C)"
Height = 495
Left = 9480
TabIndex = 11
Top = 600
Width = 1215
End
Begin VB.CommandButton Command3
Caption = "打印预览(&P)"
Height = 495
Left = 8280
TabIndex = 10
Top = 600
Width = 1215
End
Begin VB.CommandButton Command2
Caption = "清除(&E)"
Height = 495
Left = 7080
TabIndex = 9
Top = 600
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "查询(&Q)"
Height = 495
Left = 5880
TabIndex = 8
Top = 600
Width = 1215
End
Begin VB.Frame Frame2
Height = 1095
Left = 5760
TabIndex = 7
Top = 240
Width = 5175
End
Begin VB.ComboBox Combo3
Height = 300
Left = 3600
TabIndex = 3
Top = 840
Width = 1815
End
Begin VB.ComboBox Combo2
Height = 300
Left = 2520
TabIndex = 2
Top = 840
Width = 855
End
Begin VB.ComboBox Combo1
Height = 300
Left = 960
TabIndex = 1
Top = 840
Width = 1455
End
Begin VB.Frame Frame1
Height = 1095
Left = 480
TabIndex = 0
Top = 240
Width = 5175
Begin VB.Label Label3
Caption = "内容"
Height = 255
Left = 3120
TabIndex = 6
Top = 240
Width = 615
End
Begin VB.Label Label2
Caption = "操作符"
Height = 255
Left = 2160
TabIndex = 5
Top = 240
Width = 735
End
Begin VB.Label Label1
Caption = "正题名"
Height = 255
Left = 600
TabIndex = 4
Top = 240
Width = 1095
End
End
Begin VB.Label Label4
Caption = "记录总数"
Height = 375
Left = 8640
TabIndex = 13
Top = 1560
Width = 735
End
End
Attribute VB_Name = "querystbad"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public Sub showtitle()
Dim i As Integer
With MSFlexGrid1
.Cols = 15
.TextMatrix(0, 1) = "编号"
.TextMatrix(0, 2) = "学号"
.TextMatrix(0, 3) = "姓名"
.TextMatrix(0, 4) = "性别"
.TextMatrix(0, 5) = "班级"
.TextMatrix(0, 6) = "时间"
.TextMatrix(0, 7) = "警告"
.TextMatrix(0, 8) = "严重警告"
.TextMatrix(0, 9) = "记过"
.TextMatrix(0, 10) = "留校察看"
.TextMatrix(0, 11) = "劝其退学"
.TextMatrix(0, 12) = "勒令退学"
.TextMatrix(0, 13) = "开除学籍"
.TextMatrix(0, 14) = "详细描述"
.FixedRows = 1
For i = 0 To 14
.ColAlignment(i) = 0
Next i
.FillStyle = flexFillRepeat
.Col = 0
.Row = 0
.RowSel = 1
.ColSel = .Cols - 1
.CellAlignment = 4
.ColWidth(0) = 200
.ColWidth(1) = 950
.ColWidth(2) = 1200
.ColWidth(3) = 1000
.ColWidth(4) = 600
.ColWidth(5) = 800
.ColWidth(6) = 1000
.ColWidth(7) = 1000
.ColWidth(8) = 800
.ColWidth(9) = 900
.ColWidth(10) = 1200
.ColWidth(11) = 800
.ColWidth(12) = 1200
.ColWidth(13) = 3750
.FixedRows = 1
End With
End Sub
Public Sub showData()
Dim i As Integer
Dim j As Integer
Set dream = ExecuteSQL(txtSQL, Msgtext)
If dream.EOF = False Then
With MSFlexGrid1
.Rows = 1
Do While Not dream.EOF
.Rows = .Rows + 1
For i = 1 To dream.Fields.Count
Select Case dream.Fields(i - 1).Type
Case adDBDate
.TextMatrix(.Rows - 1, i) = Format(dream.Fields(i - 1) & "", "yy-mm-dd")
Case Else
.TextMatrix(.Rows - 1, i) = dream.Fields(i - 1) & " "
End Select
Next i
dream.MoveNext
Loop
End With
End If
dream.Close
End Sub
Private Sub Combo3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Call Command1_Click
End If
End Sub
Private Sub Command1_Click()
MSFlexGrid1.Clear 'use to clear old records
UserName = ""
If Combo1.Text = "" Or Combo2.Text = " " Then
MsgBox " 请设置查询条件!", vbOKOnly + vbExclamation, "提示!"
Else
txtSQL = "select * from studbad where "
txtSQL = txtSQL & Trim(Combo1.Text) & Trim(Combo2.Text) & " '" & Trim(Combo3.Text) & "'"
End If
txtSQL = txtSQL & " order by 编号 "
Set dream = ExecuteSQL(txtSQL, Msgtext)
If dream.EOF = True Then 'exsit record ?
MsgBox "没有此记录!", 48, "警告"
Else
With MSFlexGrid1
.Rows = 1
.TextMatrix(0, 1) = "编号"
.TextMatrix(0, 2) = "学号"
.TextMatrix(0, 3) = "姓名"
.TextMatrix(0, 4) = "性别"
.TextMatrix(0, 5) = "班级"
.TextMatrix(0, 6) = "时间"
.TextMatrix(0, 7) = "警告"
.TextMatrix(0, 8) = "严重警告"
.TextMatrix(0, 9) = "记过"
.TextMatrix(0, 10) = "留校察看"
.TextMatrix(0, 11) = "劝其退学"
.TextMatrix(0, 12) = "勒令退学"
.TextMatrix(0, 13) = "开除学籍"
.TextMatrix(0, 14) = "详细描述"
Do While Not dream.EOF
.Rows = .Rows + 1
.CellAlignment = 0
.TextMatrix(.Rows - 1, 1) = dream.Fields(0)
.TextMatrix(.Rows - 1, 2) = dream.Fields(1)
.TextMatrix(.Rows - 1, 3) = dream.Fields(3)
.TextMatrix(.Rows - 1, 4) = dream.Fields(2)
.TextMatrix(.Rows - 1, 5) = dream.Fields(4)
.TextMatrix(.Rows - 1, 6) = Format(dream.Fields(5), "yyyy-mm-dd")
.TextMatrix(.Rows - 1, 7) = dream.Fields(6)
.TextMatrix(.Rows - 1, 8) = dream.Fields(7)
.TextMatrix(.Rows - 1, 9) = dream.Fields(8)
.TextMatrix(.Rows - 1, 10) = dream.Fields(9)
.TextMatrix(.Rows - 1, 11) = dream.Fields(10)
.TextMatrix(.Rows - 1, 12) = dream.Fields(11)
.TextMatrix(.Rows - 1, 13) = dream.Fields(12)
' .TextMatrix(.Rows - 1, 14) = dream.Fields(13)
dream.MoveNext
Loop
End With
End If
dream.Close
End Sub
Private Sub Command2_Click()
showtitle
txtSQL = "select *from studbad"
showData
Combo1.Text = ""
Combo2.Text = ""
Combo3.Text = ""
End Sub
Private Sub Command4_Click()
Unload Me
End Sub
Private Sub Form_Load()
querystbad.Height = 9090
querystbad.Width = 12145
Combo1.AddItem "编号"
Combo1.AddItem "学号"
Combo1.AddItem "姓名"
Combo1.AddItem "性别"
Combo1.AddItem "班级"
Combo1.AddItem "时间"
Combo2.AddItem ">"
Combo2.AddItem "<"
Combo2.AddItem " >="
Combo2.AddItem "<="
Combo2.AddItem "="
Combo2.AddItem "like"
Combo1.AddItem "警告"
Combo1.AddItem "严重警告"
Combo1.AddItem "记过"
Combo1.AddItem "留校察看"
Combo1.AddItem "劝其退学"
Combo1.AddItem "勒令退学"
Combo1.AddItem "开除学籍"
Combo3.AddItem "是"
Combo3.AddItem "男"
Combo3.AddItem "女"
showtitle
txtSQL = "select *from studbad order by 编号"
showData
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -