问答文章1 问答文章501 问答文章1001 问答文章1501 问答文章2001 问答文章2501 问答文章3001 问答文章3501 问答文章4001 问答文章4501 问答文章5001 问答文章5501 问答文章6001 问答文章6501 问答文章7001 问答文章7501 问答文章8001 问答文章8501 问答文章9001 问答文章9501

VB+access评分系统

发布网友 发布时间:2022-05-15 09:26

我来回答

1个回答

热心网友 时间:2023-08-24 19:06

Option Explicit
Dim X As Integer
Dim Y As Integer
Dim fnt As Byte
Dim db As ADODB.Connection
Dim rs As ADODB.Recordset
Dim rscm As ADODB.Recordset
Public adoCon As ADODB.Connection
Public adoRS As ADODB.Recordset
Dim cn As ADODB.Connection
Dim mlink As String, mysql As String
Dim sh As String
Private Sub Command1_Click()
On Error GoTo ErrMsg
If Option1 = True Then
Label14.Visible = True
Text11.Visible = True
mysql = "select * from 成绩表 where 学号='" & Text1 & "'order by 学号"
Set cn = New ADODB.Connection
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db1.mdb;"
cn.Open
sh = "select MAX(成绩) from 成绩表 where 学号='" & Text1 & "'" '查找最高成绩
Set adoRS = cn.Execute(sh)
Text2.Text = adoRS(0)
sh = "select MIN(成绩) from 成绩表 where 学号='" & Text1 & "'" '查找最低分
Set adoRS = cn.Execute(sh)
Text3.Text = adoRS(0)
sh = "select AVG(成绩) from 成绩表 where 学号='" & Text1 & "'" '计算平均分
Set adoRS = cn.Execute(sh)
Text4.Text = adoRS(0)
sh = "select COUNT(成绩) from 成绩表 where 学号='" & Text1 & "'" & " and 成绩<60" '统计不及格门(次)
Set adoRS = cn.Execute(sh)
Text5.Text = adoRS(0)
sh = "select COUNT(成绩) from 成绩表 where 学号='" & Text1 & "'" & " and 成绩 BETWEEN 90 AND 100" '统计优秀门(次)
Set adoRS = cn.Execute(sh)
Text6.Text = adoRS(0)
sh = "select COUNT(成绩) from 成绩表 where 学号='" & Text1 & "'" & " and 成绩 BETWEEN 80 AND 89" '统计良好门(次)
Set adoRS = cn.Execute(sh)
Text7.Text = adoRS(0)
sh = "select COUNT(成绩) from 成绩表 where 学号='" & Text1 & "'" '统计总门(次)数
Set adoRS = cn.Execute(sh)
Text8.Text = adoRS(0)
Text9.Text = ((Text8.Text - Text5.Text) / Text8.Text) * 100 & "%" '计算合格率
sh = "select 姓名 from 成绩表 where 学号='" & Text1 & "'"
Set adoRS = cn.Execute(sh)
Text11.Text = adoRS(0)
End If
If Option2 = True Then
Label14.Visible = False
Text11.Visible = False
If Text11.Visible = False Then
Text11.Text = ""
End If
mysql = "select * from 成绩表 where 所在班级='" & DataCombo1 & "'" & " And 课程='" & DataCombo2 & "'order by 学号"
Set cn = New ADODB.Connection
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db1.mdb;"
cn.Open
sh = "select MAX(成绩) from 成绩表 where 所在班级='" & DataCombo1 & "'" & " And 课程='" & DataCombo2 & "'"
Set adoRS = cn.Execute(sh)
Text2.Text = adoRS(0)
sh = "select MIN(成绩) from 成绩表 where 所在班级='" & DataCombo1 & "'" & " And 课程='" & DataCombo2 & "'"
Set adoRS = cn.Execute(sh)
Text3.Text = adoRS(0)
sh = "select AVG(成绩) from 成绩表 where 所在班级='" & DataCombo1 & "'" & " And 课程='" & DataCombo2 & "'"
Set adoRS = cn.Execute(sh)
Text4.Text = adoRS(0)
sh = "select COUNT(成绩) from 成绩表 where 所在班级='" & DataCombo1 & "'" & " And 课程='" & DataCombo2 & "'" & " and 成绩<60"
Set adoRS = cn.Execute(sh)
Text5.Text = adoRS(0)
sh = "select COUNT(成绩) from 成绩表 where 所在班级='" & DataCombo1 & "'" & " And 课程='" & DataCombo2 & "'" & " and 成绩 BETWEEN 90 AND 100"
Set adoRS = cn.Execute(sh)
Text6.Text = adoRS(0)
sh = "select COUNT(成绩) from 成绩表 where 所在班级='" & DataCombo1 & "'" & " And 课程='" & DataCombo2 & "'" & " and 成绩 BETWEEN 80 AND 89"
Set adoRS = cn.Execute(sh)
Text7.Text = adoRS(0)
sh = "select COUNT(成绩) from 成绩表 where 所在班级='" & DataCombo1 & "'" & " And 课程='" & DataCombo2 & "'"
Set adoRS = cn.Execute(sh)
Text8.Text = adoRS(0)
Text9.Text = ((Text8.Text - Text5.Text) / Text8.Text) * 100 & "%"

End If
If Option3 = True Then
Label14.Visible = False
Text11.Visible = False
mysql = "select * from 成绩表 where 姓名='" & Text10 & "'order by 学号"
Set cn = New ADODB.Connection
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db1.mdb;"
cn.Open
sh = "select MAX(成绩) from 成绩表 where 姓名='" & Text10 & "'"
Set adoRS = cn.Execute(sh)
Text2.Text = adoRS(0)
sh = "select MIN(成绩) from 成绩表 where 姓名='" & Text10 & "'"
Set adoRS = cn.Execute(sh)
Text3.Text = adoRS(0)
sh = "select AVG(成绩) from 成绩表 where 姓名='" & Text10 & "'"
Set adoRS = cn.Execute(sh)
Text4.Text = adoRS(0)
sh = "select COUNT(成绩) from 成绩表 where 姓名='" & Text10 & "'" & " and 成绩<60"
Set adoRS = cn.Execute(sh)
Text5.Text = adoRS(0)
sh = "select COUNT(成绩) from 成绩表 where 姓名='" & Text10 & "'" & " and 成绩 BETWEEN 90 AND 100"
Set adoRS = cn.Execute(sh)
Text6.Text = adoRS(0)
sh = "select COUNT(成绩) from 成绩表 where 姓名='" & Text10 & "'" & " and 成绩 BETWEEN 80 AND 89"
Set adoRS = cn.Execute(sh)
Text7.Text = adoRS(0)
sh = "select COUNT(成绩) from 成绩表 where 姓名='" & Text10 & "'"
Set adoRS = cn.Execute(sh)
Text8.Text = adoRS(0)
Text9.Text = ((Text8.Text - Text5.Text) / Text8.Text) * 100 & "%"
End If
If rs.State <> adStateClosed Then
rs.Close
End If
rs.Open mysql, db, adOpenStatic, adLockOptimistic
Set DataGrid1.DataSource = rs '传递表值
rs.MoveLast
If rs.EOF = True Then
MsgBox "无此信息,请确认!"
End If
ErrMsg:
If Err.Number <> 0 Then
MsgBox CStr(Err.Number) + Err.Description, vbOKOnly + vbCritical, "错误提示"
Exit Sub
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub

Private Sub Command3_Click()
On Error GoTo ErrMsg
fnt = 15
X = 1000
Y = 1000
Printer.CurrentX = X
Printer.CurrentY = Y
Printer.FontSize = fnt
Printer.Print "学号:" & Text1
Printer.CurrentX = X
Printer.CurrentY = Y + 300
Printer.Print Label14 & Text11
Printer.CurrentX = X
Printer.CurrentY = Y + 600
Printer.Print Label5 & Text2
Printer.CurrentX = X
Printer.CurrentY = Y + 900
Printer.Print Label6 & Text3
Printer.CurrentX = X
Printer.CurrentY = Y + 1200
Printer.Print Label7 & Text4
Printer.CurrentX = X
Printer.CurrentY = Y + 1500
Printer.Print Label8 & Text5
Printer.CurrentX = X
Printer.CurrentY = Y + 1800
Printer.Print Label9 & Text6
Printer.CurrentX = X
Printer.CurrentY = Y + 2100
Printer.Print Label10 & Text7
Printer.CurrentX = X
Printer.CurrentY = Y + 2400
Printer.Print Label11 & Text8
Printer.CurrentX = X
Printer.CurrentY = Y + 2700
Printer.Print Label12 & Text9
Dim i As Long, J As Long, K As Long
Dim PrintString As String
Y = 4400
Printer.CurrentX = 1000
Printer.CurrentY = 4000
Printer.FontSize = 13
Printer.Print "学号/姓名 /课程/成绩/班级"
For i = 0 To DataGrid1.Row
If K = DataGrid1.VisibleRows Then
DataGrid1.Scroll 0, DataGrid1.VisibleRows
K = 0
End If
For J = 0 To DataGrid1.Columns.Count - 1
PrintString = PrintString & _
DataGrid1.Columns(J).CellText(DataGrid1.RowBookmark(K)) & "/"
Next
Printer.CurrentX = 1000
Printer.CurrentY = Y
Printer.FontSize = 10
Printer.Print PrintString
PrintString = ""
K = K + 1
Y = Y + 300
DoEvents
If i = DataGrid1.Row Then '无此条件则打印机与计算机不断开,不能进行新的打印任务
Printer.EndDoc
End If
Next
ErrMsg:
If Err.Number <> 0 Then
MsgBox CStr(Err.Number) + Err.Description, vbOKOnly + vbCritical, "错误提示"
Exit Sub
End If
End Sub

Private Sub Command4_Click()
DataReport2.Show
End Sub

Private Sub Form_Load()
Set db = New ADODB.Connection
Set rs = New ADODB.Recordset
db.CursorLocation = adUseClient
mlink = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db1.mdb;"
db.Open mlink
mysql = "select * from 成绩表 order by 学号"
rs.Open mysql, db, adOpenStatic, adLockOptimistic
Set DataGrid1.DataSource = rs
End Sub
声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com
临沂比较有名的男装品牌 呼伦贝尔市悦动网络科技有限公司怎么样? 呼伦贝尔中汇实业有限公司怎么样? 呼伦贝尔油玉不绝电子商务有限公司怎么样? 如何避免wps卡顿? 属鼠的男人找对象是属什么,属鼠的人和什么属相合 96年鼠的姻缘在哪年 属相相合年份运势提升 2024属鼠找对象属什么最佳 黑客攻击网站能报案吗 黑客攻击报案有用吗 液相色谱走基线不归零spd-20a spd-20a 和spd-av 的区别 丢失怎么找回? ACCESS数据库问题。要求在创建的窗体中显示:一个班级报名自学考试的成绩,每人报4门,总课程有十门。 怎样 用access创建一更新查询,要求对选修“数学”课程的学生成绩+2分。急!!! access,创建一个查询 ,查找女学生姓名、课程名、成绩三个字段内容 关于开除员工的法律 地理信息科学专业必看书籍求推荐 管理信息系统书籍有哪些 海贼王最新剧场版z用海贼王剧场版12用快播下载什么时候能看 海贼王剧场版z适合多少集以后看? 我和我同学在QQ上用情侣头像,网名,个签,已经持续1个月了,可我不想再用了,我和她关系不错,所以不 海贼王剧场版12 最强之敌z现在能看吗?可以看的话,帮忙发一下连接。 求搞笑卡通情侣头像情侣的哟一对的哟(高分你以前给过别人那个QQ头像能不能也给我个谢谢你 大家推荐几个比较好的情侣qq头像和名字 求一款这样的情侣头像 请教单分散性与多分散型的区别?? 中国最无奈的省份安徽,为什么南北城市的饮食相差那么大? 南北分界线的差异 为什么秦岭淮河一线被认为是重要的地理界线? spd-20a走基线时屏幕显示over怎么办? SPD一20A基线峰没有数字 岛津高效液相色谱spd-20a紫外检测器灵敏度多高 SPD一20A基线没有数字怎么弄 岛津液相色谱仪马达滑动错误? 岛津高效液相色谱仪lc-20a波长可以达到668nm吗 罗兰SPD-20 如何用excel一个单元格里编辑选项(例如:在一个单元格里,我想编辑城镇、农村,进行选择。)请问如何编辑 spd-m20a设置ip 我非常非常害怕虫子 怎么克服?? SPD-20-240P最大防雷电压多少 丢失如何找回? 求罗兰spd-20中文说明书,还有APC-33夹持器卖多少钱? Excel中怎样设:在A1填广州,B1可选择城镇或农村;若在A1填深圳,B1可选择深户或非深户。 投资红杉的成本太高怎么办 excel怎么设:A1填广州,B1可选城镇或农村;A1填深圳,B1可选深户或非深户;A1填佛山,B1可选本地或外地。 SPD-limp12.5KA,Up2.5KV的前端断路器配多少A合适? 怎样子才能克服我怕虫子的心理啊!!! 我有个excel表里边有xx镇xx村xx号,我只想保留xx村,要怎么操作,小白一个,求大神讲解 丢了怎么找回来?