form16.frm
来自「VB 学生管理系统,实习时候用的。现在传上来给大家看看。菜鸟作品」· FRM 代码 · 共 100 行
FRM
100 行
VERSION 5.00
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Begin VB.Form Form16
Caption = "统计各分数段人数"
ClientHeight = 1965
ClientLeft = 60
ClientTop = 345
ClientWidth = 4830
LinkTopic = "Form16"
Picture = "Form16.frx":0000
ScaleHeight = 1965
ScaleWidth = 4830
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Command2
BackColor = &H8000000E&
Height = 495
Left = 2400
Picture = "Form16.frx":2BEE2
Style = 1 'Graphical
TabIndex = 3
Top = 1320
Width = 1095
End
Begin VB.CommandButton Command1
BackColor = &H8000000E&
Height = 495
Left = 600
Picture = "Form16.frx":2ED6F
Style = 1 'Graphical
TabIndex = 2
Top = 1320
Width = 1095
End
Begin MSDataListLib.DataCombo DataCombo1
Height = 330
Left = 2160
TabIndex = 1
Top = 480
Width = 2055
_ExtentX = 3625
_ExtentY = 582
_Version = 393216
Text = ""
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "请选择或输入课程:"
Height = 180
Left = 480
TabIndex = 0
Top = 600
Width = 1620
End
End
Attribute VB_Name = "Form16"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim myrsa As New ADODB.Recordset, myrsb As New ADODB.Recordset, myrsc As New ADODB.Recordset, myrsd As New ADODB.Recordset, myrse As New ADODB.Recordset
Dim strsqla As String, strsqlb As String, strsqlc As String, strsqld As String, strsqle As String
Dim totala As Integer, totalb As Integer, totalc As Integer, totald As Integer, totale As Integer
Dim courseno As String, dispstr As String
courseno = Left(Trim(DataCombo1.Text), 4)
strsqla = "select count(*) from 课程表,学生选课 where 课程表.课程号 = 学生选课.课程号 and 学生选课.成绩 >=90 and 学生选课.成绩<=100 and 课程表.课程号 like '%" & no & "%'"
strsqlb = "select count(*) from 课程表,学生选课 where 课程表.课程号 = 学生选课.课程号 and 学生选课.成绩 >= 80 and 学生选课.成绩< 90 and 课程表.课程号 like '%" & no & "%'"
strsqlc = "select count(*) from 课程表,学生选课 where 课程表.课程号 = 学生选课.课程号 and 学生选课.成绩 >= 70 and 学生选课.成绩< 80 and 课程表.课程号 like '%" & no & "%'"
strsqld = "select count(*) from 课程表,学生选课 where 课程表.课程号 = 学生选课.课程号 and 学生选课.成绩 >= 60 and 学生选课.成绩< 70 and 课程表.课程号 like '%" & no & "%'"
strsqle = "select count(*) from 课程表,学生选课 where 课程表.课程号 = 学生选课.课程号 and 学生选课.成绩 <60 and 课程表.课程号 like '%" & no & "%'"
Set myrsa = mycon.Execute(strsqla)
Set myrsb = mycon.Execute(strsqlb)
Set myrsc = mycon.Execute(strsqlc)
Set myrsd = mycon.Execute(strsqld)
Set myrse = mycon.Execute(strsqle)
myrsa.MoveFirst
totala = myrsa.Fields(0)
myrsb.MoveFirst
totalb = myrsb.Fields(0)
myrsc.MoveFirst
totalc = myrsc.Fields(0)
myrsd.MoveFirst
totald = myrsd.Fields(0)
myrse.MoveFirst
totale = myrse.Fields(0)
dispstr = "90分以上的学生人数为" & Str(totala) & "人" & vbCrLf & _
"80-89分的学生人数为" & Str(totalb) & "人" & vbCrLf & _
"70-79分的学生人数为" & Str(totalc) & "人" & vbCrLf & _
"60-69分的学生人数为" & Str(totald) & "人" & vbCrLf & _
"60分以下的学生人数为" & Str(totale) & "人"
MsgBox dispstr, , Trim(DataCombo1.Text) & "课程统计结果"
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?