中易网

VB+access评分系统

答案:1  悬赏:80  
解决时间 2021-11-07 21:35
VB+access评分系统
最佳答案
Option ExplicitDim X As IntegerDim Y As IntegerDim fnt As ByteDim db As ADODB.ConnectionDim rs As ADODB.RecordsetDim rscm As ADODB.RecordsetPublic adoCon As ADODB.ConnectionPublic adoRS As ADODB.RecordsetDim cn As ADODB.ConnectionDim mlink As String, mysql As String Dim sh As StringPrivate Sub Command1_Click()On Error GoTo ErrMsgIf Option1 = True ThenLabel14.Visible = TrueText11.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 IfIf Option2 = True ThenLabel14.Visible = FalseText11.Visible = FalseIf Text11.Visible = False ThenText11.Text = ""End Ifmysql = "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 IfIf Option3 = True ThenLabel14.Visible = FalseText11.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 IfIf rs.State <> adStateClosed Thenrs.CloseEnd Ifrs.Open mysql, db, adOpenStatic, adLockOptimisticSet DataGrid1.DataSource = rs '传递表值rs.MoveLastIf rs.EOF = True ThenMsgBox "无此信息,请确认!"End IfErrMsg: If Err.Number <> 0 Then MsgBox CStr(Err.Number) + Err.Description, vbOKOnly + vbCritical, "错误提示" Exit Sub End IfEnd SubPrivate Sub Command2_Click()Unload MeEnd SubPrivate Sub Command3_Click()On Error GoTo ErrMsgfnt = 15X = 1000Y = 1000Printer.CurrentX = XPrinter.CurrentY = YPrinter.FontSize = fntPrinter.Print "学号:" & Text1Printer.CurrentX = XPrinter.CurrentY = Y + 300Printer.Print Label14 & Text11Printer.CurrentX = XPrinter.CurrentY = Y + 600Printer.Print Label5 & Text2Printer.CurrentX = XPrinter.CurrentY = Y + 900Printer.Print Label6 & Text3Printer.CurrentX = XPrinter.CurrentY = Y + 1200Printer.Print Label7 & Text4Printer.CurrentX = XPrinter.CurrentY = Y + 1500Printer.Print Label8 & Text5Printer.CurrentX = XPrinter.CurrentY = Y + 1800Printer.Print Label9 & Text6Printer.CurrentX = XPrinter.CurrentY = Y + 2100Printer.Print Label10 & Text7Printer.CurrentX = XPrinter.CurrentY = Y + 2400Printer.Print Label11 & Text8Printer.CurrentX = XPrinter.CurrentY = Y + 2700Printer.Print Label12 & Text9Dim i As Long, J As Long, K As Long Dim PrintString As StringY = 4400Printer.CurrentX = 1000Printer.CurrentY = 4000Printer.FontSize = 13Printer.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)) & "/" NextPrinter.CurrentX = 1000Printer.CurrentY = YPrinter.FontSize = 10 Printer.Print PrintString PrintString = "" K = K + 1 Y = Y + 300 DoEvents If i = DataGrid1.Row Then '无此条件则打印机与计算机不断开,不能进行新的打印任务 Printer.EndDoc End If NextErrMsg: If Err.Number <> 0 Then MsgBox CStr(Err.Number) + Err.Description, vbOKOnly + vbCritical, "错误提示" Exit Sub End IfEnd SubPrivate Sub Command4_Click()DataReport2.ShowEnd SubPrivate Sub Form_Load()Set db = New ADODB.ConnectionSet rs = New ADODB.Recordsetdb.CursorLocation = adUseClientmlink = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db1.mdb;"db.Open mlinkmysql = "select * from 成绩表 order by 学号"rs.Open mysql, db, adOpenStatic, adLockOptimisticSet DataGrid1.DataSource = rsEnd Sub
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
情人节选什么样的礼品更好呢?
浙江福熙防盗门价格高不高?
从温州市到北京的火车票要多少钱
佛山膨体隆鼻的大概费用是多少?
酸牛奶解酒还是纯牛奶解酒?
《人海孤鸿》or《月光肥牛小鬼头》20集 洪金
买联合一家的家具,安装费谁出呢?
怎样做辣白菜炒五花肉蘸豆腐
宝坻京津新城什么时候会火起来,今天去了那里
中国邮政储蓄银行几点上班江苏几点开门
澳洲的移民签证各有哪些要求?
伊啦啦饰品加盟店
开县大堰中学怎么去啊,我要去那办事
怎么能改善黑眼圈?
学行思知有人去过吗?怎么样?和平区有个教育
推荐资讯
急急急!!!从阳新到黄冈的汽车,早上几点发
中国福利彩票(津北公路与驯海路交叉口西南150
我们在办离婚,婆婆就不让看孩子,不让孩子给
中国移动通信(雁塔特约代办店)怎么去啊,我要
有鹤壁浚县的宝妈么你们孕期都在干嘛啊 我天
天津户口迁移问题
嘴巴没有味道,舌苔很厚很黄。怎么调理?有食
请问大神房屋甲醛如何检测
一条桑蚕丝围巾价格
50人左右的团队游戏
。镇江地区哪里可以买到iphone4裸机?联通大
如何培养学生解决问题的能力PPT
手机登qq时,显示手机磁盘不足,清理后重新登
刺客的套装怎么选啊?