📄 inquirecj.frm
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form inquireCj
BorderStyle = 3 'Fixed Dialog
Caption = "查询成绩信息"
ClientHeight = 5385
ClientLeft = 4575
ClientTop = 3360
ClientWidth = 6885
Icon = "inquireCj.frx":0000
LinkTopic = "Form3"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 5385
ScaleWidth = 6885
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame1
Height = 2055
Left = 0
TabIndex = 0
Top = 3240
Width = 6855
Begin VB.CommandButton cmdExit
Caption = "退出查询"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 4440
TabIndex = 9
Top = 1320
Width = 1212
End
Begin VB.CommandButton cmdInquire
Caption = "查询"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 4440
TabIndex = 8
Top = 480
Width = 1212
End
Begin VB.Frame Frame3
Caption = "课程名称:"
Height = 615
Left = 120
TabIndex = 6
Top = 1320
Width = 2775
Begin VB.ComboBox Combo1
BackColor = &H80000018&
Height = 300
Index = 1
ItemData = "inquireCj.frx":08CA
Left = 600
List = "inquireCj.frx":08CC
TabIndex = 7
Top = 180
Width = 2055
End
End
Begin VB.Frame Frame4
Caption = "学期:"
Height = 615
Left = 120
TabIndex = 4
Top = 720
Width = 2775
Begin VB.ComboBox Combo1
BackColor = &H80000018&
Height = 300
Index = 3
ItemData = "inquireCj.frx":08CE
Left = 600
List = "inquireCj.frx":08EA
TabIndex = 5
Text = "大一上学期"
Top = 180
Width = 2055
End
End
Begin VB.Frame Frame2
Caption = "学号:"
Height = 615
Left = 120
TabIndex = 2
Top = 120
Width = 2775
Begin VB.ComboBox Combo1
BackColor = &H80000018&
Height = 300
Index = 0
ItemData = "inquireCj.frx":094E
Left = 600
List = "inquireCj.frx":0950
TabIndex = 3
Top = 180
Width = 2055
End
End
Begin VB.CheckBox Check1
Caption = "按学号:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 252
Index = 0
Left = 240
TabIndex = 1
Top = 360
Width = 1212
End
Begin VB.Line Line1
BorderColor = &H8000000D&
X1 = 3480
X2 = 3480
Y1 = 120
Y2 = 2040
End
End
Begin MSFlexGridLib.MSFlexGrid myflexgrid
Height = 3255
Left = 0
TabIndex = 10
Top = 0
Width = 6855
_ExtentX = 12091
_ExtentY = 5741
_Version = 393216
Cols = 4
End
End
Attribute VB_Name = "inquireCj"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub cmdInquire_Click()
Dim mrc As ADODB.Recordset
txtSQL = "select * from cj "
If Not Combo1(0).Text = "" Then
txtSQL = txtSQL & "where 学号='" & Trim(Combo1(0).Text) & "'"
End If
If Not Combo1(3).Text = "" Then
If Not Combo1(0).Text = "" Then
txtSQL = txtSQL & "and 学期='" & Trim(Combo1(3).Text) & "'"
Else
txtSQL = txtSQL & "where 学期='" & Trim(Combo1(3).Text) & "'"
End If
End If
If Not Combo1(1).Text = "" Then
If Not Combo1(3).Text = "" Or Not Combo1(0).Text = "" Then
txtSQL = txtSQL & "and 课程名称='" & Trim(Combo1(1).Text) & "'"
Else
txtSQL = txtSQL & "where 课程名称='" & Trim(Combo1(1).Text) & "'"
End If
End If
Set mrc = ExecuteSQL(txtSQL)
With myflexgrid
.Rows = 1
.CellAlignment = 4
.TextMatrix(0, 0) = "学号"
.TextMatrix(0, 1) = "学期"
.TextMatrix(0, 2) = "课程名称"
.TextMatrix(0, 3) = "成绩"
Do While Not mrc.EOF
.Rows = .Rows + 1
.CellAlignment = 4
.TextMatrix(.Rows - 1, 0) = mrc.Fields(1)
.TextMatrix(.Rows - 1, 1) = mrc.Fields(2)
.TextMatrix(.Rows - 1, 2) = mrc.Fields(3)
.TextMatrix(.Rows - 1, 3) = mrc.Fields(4)
mrc.MoveNext
Loop
End With
mrc.Close
End Sub
Private Sub Form_Load()
With myflexgrid
.CellAlignment = 4
.TextMatrix(0, 0) = "学号"
.TextMatrix(0, 1) = "学期"
.TextMatrix(0, 2) = "课程名称"
.TextMatrix(0, 3) = "成绩"
End With
Dim mrc As ADODB.Recordset
txtSQL = "select 学号 from stud"
Set mrc = ExecuteSQL(txtSQL)
If mrc.EOF = True Then
Exit Sub
End If
mrc.MoveFirst
Do Until mrc.EOF
Combo1(0).AddItem mrc.Fields(0)
mrc.MoveNext
Loop
Set mrc = Nothing
txtSQL = "select 课程名称 from zpcourse "
Set mrc = ExecuteSQL(txtSQL)
If mrc.EOF = True Then
Exit Sub
End If
mrc.MoveFirst
Do Until mrc.EOF
Combo1(1).AddItem mrc.Fields(0)
mrc.MoveNext
Loop
Set mrc = Nothing
End Sub
Private Sub Form_Unload(Cancel As Integer)
frmMain.Enabled = True
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -