📄 学生成绩查询界面.frm
字号:
VERSION 5.00
Begin VB.Form 学生成绩查询界面
BorderStyle = 1 'Fixed Single
Caption = "学生成绩查询"
ClientHeight = 6375
ClientLeft = 45
ClientTop = 330
ClientWidth = 7005
Icon = "Form5.frx":0000
LinkTopic = "Form5"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 6375
ScaleWidth = 7005
StartUpPosition = 1 '所有者中心
Begin VB.Frame Frame1
Caption = "成绩查询:"
Height = 6135
Left = 120
TabIndex = 0
Top = 120
Width = 6735
Begin VB.CommandButton Command3
Caption = "统计"
Height = 375
Left = 2880
TabIndex = 16
Top = 2280
Width = 1095
End
Begin VB.CommandButton Command1
BackColor = &H00C0C0C0&
Caption = "开始查询"
Height = 375
Left = 1080
TabIndex = 14
Top = 2280
UseMaskColor = -1 'True
Width = 1095
End
Begin VB.CommandButton Command2
BackColor = &H00C0C0C0&
Caption = "关闭"
Height = 375
Left = 4680
TabIndex = 13
Top = 2280
UseMaskColor = -1 'True
Width = 1095
End
Begin VB.Frame Frame3
Caption = "查询结果:"
Height = 3255
Left = 600
TabIndex = 11
Top = 2760
Width = 5655
Begin VB.PictureBox Adodc1
BackColor = &H80000005&
ForeColor = &H80000008&
Height = 375
Left = 240
ScaleHeight = 315
ScaleWidth = 4995
TabIndex = 17
Top = 2760
Width = 5055
End
Begin VB.PictureBox DataGrid1
Height = 2295
Left = 120
ScaleHeight = 2235
ScaleWidth = 5355
TabIndex = 12
Top = 360
Width = 5415
End
End
Begin VB.Frame Frame2
Caption = "查询条件:"
Height = 1815
Left = 600
TabIndex = 1
Top = 360
Width = 5655
Begin VB.ComboBox Combo4
Height = 300
ItemData = "Form5.frx":030A
Left = 1200
List = "Form5.frx":030C
TabIndex = 15
Top = 1320
Width = 1215
End
Begin VB.OptionButton Option1
Caption = "分数线以上"
Height = 375
Index = 0
Left = 3000
TabIndex = 10
Top = 840
Width = 1455
End
Begin VB.OptionButton Option1
Caption = "分数线以下"
Height = 375
Index = 1
Left = 3000
TabIndex = 9
Top = 1200
Width = 1455
End
Begin VB.CheckBox Check1
Caption = "学期"
Height = 495
Left = 240
TabIndex = 8
Top = 240
Width = 975
End
Begin VB.CheckBox Check2
Caption = "分类"
Height = 495
Left = 240
TabIndex = 7
Top = 720
Width = 975
End
Begin VB.CheckBox Check3
Caption = "课程名"
Height = 495
Left = 240
TabIndex = 6
Top = 1200
Width = 975
End
Begin VB.CheckBox Check4
Caption = "分数线"
Height = 495
Left = 3000
TabIndex = 5
Top = 240
Width = 855
End
Begin VB.ComboBox Combo2
Height = 300
ItemData = "Form5.frx":030E
Left = 1200
List = "Form5.frx":0310
TabIndex = 4
Top = 840
Width = 1215
End
Begin VB.ComboBox Combo3
Height = 300
ItemData = "Form5.frx":0312
Left = 4080
List = "Form5.frx":031F
TabIndex = 3
Text = "85"
Top = 360
Width = 1215
End
Begin VB.ComboBox Combo1
DataField = "学期"
DataSource = "Adodc2"
Height = 300
ItemData = "Form5.frx":032F
Left = 1200
List = "Form5.frx":0331
TabIndex = 2
Top = 360
Width = 1215
End
End
Begin VB.PictureBox Adodc2
BackColor = &H80000005&
Enabled = 0 'False
ForeColor = &H80000008&
Height = 375
Left = 960
ScaleHeight = 315
ScaleWidth = 1155
TabIndex = 18
Top = 1680
Width = 1215
End
Begin VB.PictureBox Adodc3
BackColor = &H80000005&
Enabled = 0 'False
ForeColor = &H80000008&
Height = 375
Left = 2280
ScaleHeight = 315
ScaleWidth = 1155
TabIndex = 19
Top = 1680
Width = 1215
End
Begin VB.PictureBox Adodc4
BackColor = &H80000005&
Enabled = 0 'False
ForeColor = &H80000008&
Height = 375
Left = 3600
ScaleHeight = 315
ScaleWidth = 1155
TabIndex = 20
Top = 1680
Width = 1215
End
End
End
Attribute VB_Name = "学生成绩查询界面"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Check1_Click()
Dim i As Integer
If Check1.Value = 1 Then
Call Check3_Click
Combo1.Enabled = True
Adodc2.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path + "\data.MDe;Persist Security Info=False"
Adodc2.CommandType = adCmdText
SQL = "select distinct 学期 from liebie"
Adodc2.RecordSource = SQL
Adodc2.Refresh
For i = 0 To Adodc2.Recordset.RecordCount - 1
Combo1.List(i) = Adodc2.Recordset.Fields(0)
Adodc2.Recordset.MoveNext
Next
Adodc2.Recordset.MoveFirst
Combo1.Text = Adodc2.Recordset.Fields(0)
Else
Combo1.Enabled = False
End If
Call Check3_Click
End Sub
Private Sub Check2_Click()
If Check2.Value = 1 Then
Call Check3_Click
Combo2.Enabled = True
Adodc3.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path + "\data.MDe;Persist Security Info=False"
Adodc3.CommandType = adCmdText
SQL = "select distinct 分类 from liebie"
Adodc3.RecordSource = SQL
Adodc3.Refresh
On Error Resume Next
For i = 0 To Adodc3.Recordset.RecordCount - 1
Combo2.List(i) = Adodc3.Recordset.Fields(0)
Adodc3.Recordset.MoveNext
Next
Adodc3.Recordset.MoveFirst
Combo2.Text = Adodc3.Recordset.Fields(0)
Else
Combo2.Enabled = False
End If
Call Check3_Click
End Sub
Private Sub Check3_Click()
Dim str As String
Dim tiaojian As Integer
tiaojian = 0
Combo4.Clear
If Check3.Value = 1 Then
Combo4.Enabled = True
If Check1.Value = 1 Then
tiaojian = 1
End If
If Check2.Value = 1 Then
tiaojian = 2
End If
If Check1.Value = 1 And Check2.Value = 1 Then
tiaojian = 3
End If
'MsgBox tiaojian
If tiaojian = 0 Then
str = "select distinct 科目 from liebie"
End If
If tiaojian = 1 Then
str = "select distinct 科目 from liebie where 学期 = " & Val(Combo1.Text)
End If
If tiaojian = 2 Then
str = "select distinct 科目 from liebie where 分类 = " & Val(Combo2.Text)
End If
If tiaojian = 3 Then
str = "select distinct 科目 from liebie where 学期 = " & Val(Combo1.Text) & " and 分类 = " & Val(Combo2.Text)
End If
'MsgBox str
Adodc4.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path + "\data.MDe;Persist Security Info=False"
Adodc4.CommandType = adCmdText
SQL = str
Adodc4.RecordSource = SQL
Adodc4.Refresh
For i = 0 To Adodc4.Recordset.RecordCount - 1
Combo4.List(i) = Adodc4.Recordset.Fields(0)
Adodc4.Recordset.MoveNext
Next
'Adodc4.Recordset.MoveFirst
'Combo4.Text = Adodc4.Recordset.Fields(0)
Else
Combo4.Enabled = False
End If
End Sub
Private Sub Check4_Click()
If Check4.Value = 1 Then
Combo3.Enabled = True
Option1(0).Enabled = True
Option1(1).Enabled = True
Option1(0).Value = True
Else
Option1(0).Enabled = False
Option1(1).Enabled = False
Combo3.Enabled = False
End If
End Sub
Private Sub Combo1_Click()
Call Check3_Click
End Sub
Private Sub Combo2_Click()
Call Check3_Click
End Sub
Private Sub Command1_Click()
Dim tiaojian As Integer
Dim str As String
Dim strend As String
str = "select data.学号,data.姓名,chengji.学期,chengji.科目,chengji.成绩,liebie.分类 from data,chengji,liebie where data.学号=chengji.学号 and chengji.学期=liebie.学期 and chengji.科目=liebie.科目 "
strend = " order by data.学号,chengji.学期"
If Check1.Value = 1 Then
str = str & " and liebie.学期 = " & Val(Combo1.Text)
End If
If Check2.Value = 1 Then
str = str & " and liebie.分类 = " & Val(Combo2.Text)
End If
If Check3.Value = 1 Then
str = str & " and liebie.科目 = '" & Combo4.Text & "'"
End If
If Check4.Value = 1 Then
If Option1(0).Value = True Then
str = str & " and chengji.成绩 >= " & Val(Combo3.Text)
Else
str = str & " and chengji.成绩 <= " & Val(Combo3.Text)
End If
End If
str = str & strend
'MsgBox str
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path + "\data.MDe;Persist Security Info=False"
Adodc1.CommandType = adCmdText
SQL = str
Adodc1.RecordSource = SQL
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1
DataGrid1.Refresh
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Command3_Click()
'Adodc1.Recordset.Filter = adFilterNone
c = Adodc1.Recordset.RecordCount
Adodc1.Recordset.MoveFirst
a = Adodc1.Recordset("姓名")
b = Adodc1.Recordset("成绩")
s = s + b
p = IIf(b < 60, a & ",", "")
For n = 1 To c - 1
Adodc1.Recordset.MoveNext
a = Adodc1.Recordset("姓名")
b = Adodc1.Recordset("成绩")
s = s + b
p = IIf(b < 60, p & a & ",", p)
Next
p = IIf(p <> "", "不及格的同学有:" & p, "")
MsgBox bj & km & "全班同学成绩平均分:" & (s / c) & " ,总分为:" & s & Chr(13) & p, , "系统统计"
End Sub
Private Sub Form_Load()
Option1(0).Enabled = False
Option1(1).Enabled = False
Combo1.Enabled = False
Combo2.Enabled = False
Combo3.Enabled = False
Combo4.Enabled = False
End Sub
Private Sub Frame1_DragDrop(Source As Control, X As Single, Y As Single)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -