资源简介 成绩管理系统说明书运行环境:本软件需WINDOWS操作系统的支持,硬件要求只是能安装WINDOWS系统即可。本软件的基本功能:a.本软件是纯汉字系统,操作简单明了,主要有三大模块:信息录入模块,包括原始信息如学生和课程信息的录入和成绩的录入。b.信息查询模块,该模块提供了多条件查询功能,界面明了简单易操作,并比较实用。c.数据维护模块包括数据的备份和恢复以及数据的追加和初始化功能。本软件的特点:本软件整体采用下拉式菜单管理,具体的界面大都采用框架式结构,使整体感觉到比较清晰明了,功能区和数据显示区明显开来,各控件的约束也能让操作者更简单易行。本软件的具体实现:本软件是一个数据库管理软件,因此,它主要是与数据库的操作关系较大。本软采用了ADO数据控制部件,它有比DATA数据控件更优越的功效,支持远程数据管理,并且它的数据管理更简。在原始数据(学生信息和课程信息)录入中,文本框和命令按钮都使用了控件数组,这对于代的书写更能简单,使代码集成化并使冗余更少,使程序更易于阅读;文本框直接邦定到数据库,使操作更简单。为解决ADO数据源在不同框架中不同,因此要依据框架来设定数据源,并在框架被击活之前把框架中的文本框邦定到数据库。文本框也加入了KEYPRESS函数,键入回车键之后如果代码窗口的内容合乎要求就跳至下一要输入的文本框或要操作的对象上,让用户更便于操作。此外,为便于用户使用,录入中也提供了记录的查找以便于修改已录入的错误数据,删除数据时也设计了提示框,以确认用户的操作正确。在成绩录入中,有录入过滤条件以更方便用户的操作,为了更好的方便用户,本系统还使用了多表查询技术,并把表student、表course中的学号信息、课程号信息的所有可能组合先加入到表score中,以便在录入时只需录入成绩;录入时采用了datagrid数据控件,使数据记录表格化,能加快用户的录入速度。另外,在数据查询中应用的技术与在成绩录入中的相同,只不过是在此处的数据不允许用户修改罢了。在这里更体现了多表查询的妙用,可以方便快捷地从三个表中提取数据。在一些控件的使用上,因为本软件的一大特点是仅有唯一的一个主窗口,没有别的窗口,只是利用了框架的属性来改变当前窗口的操作对象,主要是用到了框架的“允许操作”属性和“可见”属性。在软件还用到不少的控件,比如复选框等,让整个操作界面更显得有声色。本程序附的原码较,但由于时间短未能一一写明其每一层语句的功能和实现方法,仅能在每一个函数之前加一句说明性文字来说明每一个函数的作用。(祥见所附原码)'如果记录超出范围,则执行此函数Private Sub Adodc1_EndOfRecordset(fMoreData As Boolean, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)If Adodc1.Recordset.RecordCount <> 0 ThenMsgBox ("记录已经超出范围")Adodc1.Recordset.MoveFirstEnd IfEnd Sub'成绩查询框中的条件复选来选定对应的输入框,选中则使文本框有效,否则无效。Private Sub cjcxcheck_Click(Index As Integer)Select Case IndexCase 0If cjcxcheck(0).Value = 1 Thencjcxtext(0).BackColor = &H80000005cjcxtext(0).Enabled = TrueElsecjcxtext(0).BackColor = &H8000000Fcjcxtext(0).Enabled = FalseEnd IfCase 1If cjcxcheck(1).Value = 1 Thencjcxtext(1).BackColor = &H80000005cjcxtext(1).Enabled = TrueElsecjcxtext(1).BackColor = &H8000000Fcjcxtext(1).Enabled = FalseEnd IfCase 2If cjcxcheck(2).Value = 1 Thencjcxtext(2).BackColor = &H80000005cjcxtext(2).Enabled = TrueElsecjcxtext(2).BackColor = &H8000000Fcjcxtext(2).Enabled = FalseEnd IfEnd SelectEnd SubPrivate Sub cjcxcomm_Click(Index As Integer)Dim cjtj As StringSelect Case IndexCase 0If cjcxcheck(0).Value = 1 ThenIf cjtj <> "" Thencjtj = cjtj + " and (sclass like " & cjcxtext(0).Text & ")"Elsecjtj = cjtj + " (sclass like " & cjcxtext(0).Text & ")"End IfEnd IfIf cjcxcheck(1).Value = 1 ThenIf cjtj <> "" Thencjtj = cjtj + " and (o like " & cjcxtext(1).Text & " )"Elsecjtj = cjtj + " (strcomp(o, " & cjcxtext(1).Text & " )=0)"End IfEnd IfIf cjcxcheck(2).Value = 1 ThenIf cjtj <> "" Thencjtj = cjtj + " and (cteam like " & cjcxtext(2).Text & " ) "Elsecjtj = cjtj + " (cteam like " & cjcxtext(2).Text & " ) "End IfEnd IfIf cjtj <> "" ThenAdodc1.RecordSource = "select student.sname,ame,score.sgrade,course.cteam,score.sagain from student,course,score where (strcomp( student.sno, score.sno )=0) and (strcomp( o , o )=0) and " & cjcj & " "ElseAdodc1.RecordSource = "select student.sname,ame,score.sgrade,course.cteam,score.sagain from student,course,score where (strcomp( student.sno, score.sno )=0) and (strcomp( o , o )=0)"End IfAdodc1.RefreshCase 1Case 2Case 3Case 4cxjgfram.Visible = Falsecxjgfram.Enabled = Falsecjcxfram.Visible = Falsecjcxfram.Enabled = Falsexxgl.Enabled = TrueBBDY.Enabled = Truextwh.Enabled = Truetcxt.Enabled = Truecxtj.Enabled = TrueEnd SelectEnd SubPrivate Sub cjlrcheck_Click(Index As Integer)Select Case IndexCase 0If cjlrcheck(0).Value = 1 Thencjlrtext(0).BackColor = &H80000005cjlrtext(0).Enabled = TrueElsecjlrtext(0).BackColor = &H8000000Fcjlrtext(0).Enabled = FalseEnd IfCase 1If cjlrcheck(1).Value = 1 Thencjlrtext(1).BackColor = &H80000005cjlrtext(1).Enabled = Truecjlrtext(2).BackColor = &H80000005cjlrtext(2).Enabled = TrueElsecjlrtext(1).BackColor = &H8000000Fcjlrtext(1).Enabled = Falsecjlrtext(2).BackColor = &H8000000Fcjlrtext(2).Enabled = FalseEnd IfCase 2If cjlrcheck(2).Value = 1 Thencjlrtext(3).BackColor = &H80000005cjlrtext(3).Enabled = TrueElsecjlrtext(3).BackColor = &H8000000Fcjlrtext(3).Enabled = FalseEnd IfEnd SelectEnd SubPrivate Sub cjlrcomm_Click(Index As Integer)Dim gltj As StringSelect Case IndexCase 0gltj = ""If cjlrcheck(0).Value = 1 ThenIf gltj <> "" Thengltj = gltj + " and (sclass like " & cjlrtext(0).Text & ")"Elsegltj = gltj + " (sclass like " & cjlrtext(0).Text & ")"End IfEnd IfIf cjlrcheck(1).Value = 1 ThenIf gltj <> "" Thengltj = gltj + " and ((strcomp(sno, " & cjlrtext(1).Text & ")=0 or (strcomp(sno, " & cjlrtext(1).Text & ")=1) and ((strcomp(sno, " & cjlrtext(2).Text & ")=0 or (strcomp(sno, " & cjlrtext(2).Text & ")=-1))"Elsebltj = gltj + " ((strcomp(sno, " & cjlrtext(1).Text & ")=0 or (strcomp(sno, " & cjlrtext(1).Text & ")=1) and ((strcomp(sno, " & cjlrtext(2).Text & ")=0 or (strcomp(sno, " & cjlrtext(2).Text & ")=-1))"End IfEnd IfIf cjlrcheck(2).Value = 1 ThenIf gltj <> "" Thengltj = gltj + " and (cteam like " & cjlrtext(3).Text & ")"Elsegltj = gltj + " (cteam like " & cjlrtext(3).Text & ")"End IfEnd IfIf gltj = "" ThenAdodc1.RecordSource = "select score.* from student,course,score where (student.sno=score.sno) and (o=o) "ElseAdodc1.RecordSource = "select score.* from student,course,score where (student.sno=score.sno) and (o=o) and " & gltj & ""End IfAdodc1.RefreshCase 1cjlrgl.Visible = Falsecjlrfram.Enabled = Falsecjlrfram.Visible = Falsecjlrgl.Enabled = Falsexxgl.Enabled = Truecxtj.Enabled = TrueBBDY.Enabled = Truextwh.Enabled = Truetcxt.Enabled = TrueEnd SelectEnd SubPrivate Sub cjlrtext_KeyPress(Index As Integer, KeyAscii As Integer)Select Case IndexCase 0If KeyAscii = 13 Thencjlrcomm(0).SetFocusEnd IfCase 1If KeyAscii = 13 Thencjlrtext(2).SetFocusEnd IfCase 2If KeyAscii = 13 Thencjlrcomm(0).SetFocusEnd IfCase 3If KeyAscii = 13 Thencjlrcomm(0).SetFocusEnd IfEnd SelectEnd SubPrivate Sub coursecomm_Click(Index As Integer)Dim strs1 As StringDim cjdw As StringDim qrl As IntegerDim ls As BooleanDim lscno As StringDim lsname As StringDim lstest As StringDim lstime As StringDim lsgrade As StringDim lsteam As StringDim lsmemo As StringSelect Case IndexCase 0If coursecomm(0).Caption = "新增" Thencoursecomm(0).Caption = "保存"coursecomm(8).Caption = "放弃"Adodc1.Recordset.AddNew'ls = Falseaa (False)coursetext(0).SetFocusElse'Adodc1.Recordset.Filter = "cno like " & coursetext(0).Text & ""'If Adodc1.Recordset.EOF = True Thencoursecomm(0).Caption = "新增"coursecomm(8).Caption = "退出"Adodc1.Recordset.UpdateBatch 'adAffectAllaa (True)'Else'MsgBox ("课程号重复,请重复输入!")'coursetext(O).SetFocus'End IfEnd IfCase 1If Adodc1.Recordset.RecordCount <> 0 Thenqrl = MsgBox("确实要删除该记录吗", vbOKCancel)If qrl = 2 ThenExit SubEnd IfAdodc1.Recordset.DeleteAdodc1.RefreshEnd IfCase 2If Adodc1.Recordset.RecordCount <> 0 Thencoursecomm(0).Caption = "保存"coursecomm(8).Caption = "放弃"'lscno = Adodc1.Recordset.Fields(0)'lscname = Adodc1.Recordset.Fields(1)'lstest = Adodc1.Recordset.Fields(2)'lstime = Adodc1.Recordset.Fields(3)'lsgrade = Adodc1.Recordset.Fields(4)'lsteam = Adodc1.Recordset.Fields(5)'lsmemo = Adodc1.Recordset.Fields(6)' Adodc1.Recordset.Delete' Adodc1.Refresh' Adodc1.Recordset.AddNew' ls = Trueaa (False)End IfCase 3If Adodc1.Recordset.RecordCount <> 0 Thenstrs1 = "请输入课程号" + Chr(13) + Chr(10) + "然后单击确定"cjdw = InputBox$(strs1, "课程号输入框", , 100, 100)If cjdw <> "" ThenAdodc1.Recordset.Filter = "cno like " & cjdw & ""If Adodc1.Recordset.EOF = True ThenMsgBox ("对不起,没找到!")Adodc1.RefreshEnd IfEnd IfEnd IfCase 4If Adodc1.Recordset.RecordCount <> 0 ThenAdodc1.Recordset.MoveFirstEnd IfCase 5If Adodc1.Recordset.RecordCount <> 0 ThenAdodc1.Recordset.MoveLastEnd IfCase 6If Adodc1.Recordset.RecordCount <> 0 ThenAdodc1.Recordset.MovePreviousEnd IfCase 7If Adodc1.Recordset.RecordCount <> 0 ThenAdodc1.Recordset.MoveNextEnd IfCase 8If coursecomm(8).Caption = "退出" Thencoursefram.Visible = Falsecoursefram.Enabled = FalseAdodc1.Enabled = Falsexxgl.Enabled = Truecxtj.Enabled = TrueBBDY.Enabled = Truextwh.Enabled = Truetcxt.Enabled = TrueElsecoursecomm(0).Caption = "新增"coursecomm(8).Caption = "退出"'If ls Then' coursetext(0).Text = lscno' coursetext(1).Text = lscname' coursetext(2).Text = lstest' coursetext(3).Text = lstime' coursetext(4).Text = lsgrade' coursetext(5).Text = lsteam' coursetext(6).Text = lsmemo' Adodc1.Recordset.UpdateBatch' ElseAdodc1.Recordset.CancelUpdate'End IfAdodc1.Refreshaa (True)coursecomm(0).SetFocusEnd IfEnd SelectEnd SubPrivate Sub coursetext_KeyPress(Index As Integer, KeyAscii As Integer)If KeyAscii = 13 ThenSelect Case IndexCase 0, 1, 2coursetext(Index + 1).SetFocusCase 3, 4coursetext(Index + 1).SetFocusIf IsNumeric(coursetext(Index)) ThenElseMsgBox ("输入的数据非法,请重新输入!")coursetext(Index).SetFocusEnd IfCase 5coursetext(Index + 1).SetFocusCase 6coursecomm(0).SetFocusEnd SelectEnd IfEnd SubPrivate Sub Form_Load()xsxxgl.Enabled = Falsexsxxgl.Visible = Falsescorefram.Enabled = Falsescorefram.Visible = Falsecoursefram.Enabled = Falsecoursefram.Visible = Falsecxjgfram.Enabled = Falsecxjgfram.Visible = Falsekccxfram.Enabled = Falsekccxfram.Visible = faslexscxfram.Enabled = Falsexscxfram.Visible = Falsecjlrfram.Enabled = Falsecjlrfram.Visible = Falsecjlrgl.Enabled = Falsecjlrgl.Visible = Falsecjcxfram.Visible = Falsecjcxfram.Enabled = False'Dim cn As ADODB.Connection'Dim rs As ADODB.Recordset'Set cn = New ADODB.Connection'Set rs = New ADODB.Recordset' Set properties of the Connection.'cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=D:\xscjglxt\cjgl.mdb"'cn.ConnectionTimeout = 30'cn.Open'If cn.State = adStateOpen Then''' MsgBox "Connection to xsxxk Successful!"'End IfEnd SubPrivate Sub kccx_Click(Index As Integer)Dim cxstr As StringIf kccxcheck(0).Value = 1 ThenIf cxstr <> "" Thencxstr = cxstr + " and ( strcomp(cno, " & kccxtext(0).Text & ")=1 or strcomp(cno, " & kccxtext(0).Text & ")=0) and ( strcomp(cno, " & kccxtext(1).Text & ")=-1 or strcomp(cno, " & kccxtext(1).Text & ")=0 )"Elsecxstr = cxstr + "( strcomp(cno, " & kccxtext(0).Text & ")=1 or strcomp(cno, " & kccxtext(0).Text & ")=0) and ( strcomp(cno, " & kccxtext(1).Text & ")=-1 or strcomp(cno, " & kccxtext(1).Text & ")=0 )"End IfEnd IfIf kccxcheck(1).Value = 1 ThenIf cxstr <> "" Thencxstr = cxstr + " and ( cname like " & kccxtext(2).Text & " ) "Elsecxstr = cxstr + "( cname like " & kccxtext(2).Text & " ) "End IfEnd IfIf kccxcheck(2).Value = 1 ThenIf cxstr <> "" Thencxstr = cxstr + " and ( cteam like " & kccxtext(3).Text & " ) "Elsecxstr = cxstr + " ( cteam like " & kccxtext(3).Text & " ) "End IfEnd IfSelect Case IndexCase 0If cxstr = "" ThenAdodc1.RecordSource = "select * from course"ElseAdodc1.RecordSource = "select * from course where " & cxstr & "" 'cno>=0 and & cxstr & order by cno"End IfAdodc1.Refreshcxstr = ""Case 1kccxfram.Enabled = Falsekccxfram.Visible = Falsecxjgfram.Enabled = Falsecxjgfram.Visible = Falsexxgl.Enabled = Truecxtj.Enabled = TrueBBDY.Enabled = Truextwh.Enabled = Truetcxt.Enabled = TrueEnd SelectEnd SubPrivate Sub kccxcheck_Click(Index As Integer)Select Case IndexCase 0If kccxcheck(0).Value = 0 Thenkccxtext(0).BackColor = &H8000000Fkccxtext(0).Text = ""kccxtext(0).Enabled = Falsekccxtext(1).BackColor = &H8000000Fkccxtext(1).Text = ""kccxtext(1).Enabled = FalseElsekccxtext(0).Enabled = Truekccxtext(0).BackColor = &H80000005kccxtext(1).Enabled = Truekccxtext(1).BackColor = &H80000005End IfCase 1If kccxcheck(1).Value = 0 Thenkccxtext(2).BackColor = &H8000000Fkccxtext(2).Text = ""kccxtext(2).Enabled = FalseElsekccxtext(2).Enabled = Truekccxtext(2).BackColor = &H80000005End IfCase 2If kccxcheck(2).Value = 0 Thenkccxtext(3).BackColor = &H8000000Fkccxtext(3).Text = ""kccxtext(3).Enabled = FalseElsekccxtext(3).Enabled = Truekccxtext(3).BackColor = &H80000005End IfEnd SelectEnd SubPrivate Sub kccxtext_KeyPress(Index As Integer, KeyAscii As Integer)Select Case IndexCase 0If KeyAscii = 13 Thenkccxtext(1).SetFocusEnd IfCase 1, 2, 3If KeyAscii = 13 Thenkccx(0).SetFocusEnd IfEnd SelectEnd SubPrivate Sub scorefram_DragDrop(Source As Control, X As Single, Y As Single)cjcomm(0).SetFocusEnd SubPrivate Sub sjwh_Click(Index As Integer)Dim qrl As StringDim str As StringSelect Case IndexCase 0Case 1Case 2qrl = MsgBox("真的要初始化数据吗?", vbOKCancel)If qrl = 1 Thenstr = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=d:\xscjglxt\cjgl.mdb"Adodc1.ConnectionString = strAdodc1.CommandType = adCmdTextAdodc1.RecordSource = "select * from student"Do While Adodc1.Recordset.RecordCount <> 0Adodc1.Recordset.MoveFirstAdodc1.Recordset.DeleteAdodc1.RefreshLoopAdodc1.RecordSource = "select * from course"Do While Adodc1.Recordset.RecordCount <> 0Adodc1.Recordset.MoveFirstAdodc1.Recordset.DeleteAdodc1.RefreshLoopAdodc1.RecordSource = "select * from score"Do While Adodc1.Recordset.RecordCount <> 0Adodc1.Recordset.MoveFirstAdodc1.Recordset.DeleteAdodc1.RefreshLoopEnd IfEnd SelectEnd SubPrivate Sub tcxt_Click()Dim qrl As Stringqrl = MsgBox("真的要退出系统吗?", vbOKCancel)If qrl = 1 ThenEndEnd IfEnd SubPrivate Sub xbcheck_KeyPress(KeyAscii As Integer)If KeyAscii = 13 Thenxstext(2).SetFocusEnd IfEnd SubPrivate Sub xscomm_Click(Index As Integer)'Dim xhdw As String'Dim strs1 As String'On Error GoTo xxtsDim qrl As IntegerSelect Case IndexCase 0If xscomm(0).Caption = "新增" Thenxscomm(0).Caption = "保存"xscomm(8).Caption = "放弃"Adodc1.Recordset.AddNewaa (False)Elsexscomm(0).Caption = "新增"xscomm(8).Caption = "退出"Adodc1.Recordset.UpdateBatch adAffectAllaa (True)End IfCase 1If Adodc1.Recordset.RecordCount <> 0 Thenxscomm(0).Caption = "保存"xscomm(8).Caption = "放弃"aa (False)End IfCase 2'If xscomm(2).Caption = "删除" ThenIf Adodc1.Recordset.RecordCount <> 0 Thenqrl = MsgBox("确实要删除该记录吗", vbOKCancel)If qrl = 2 ThenExit SubEnd IfAdodc1.Recordset.DeleteAdodc1.Recordset.MoveNextAdodc1.RefreshEnd IfCase 3If Adodc1.Recordset.RecordCount <> 0 Then' If xscomm(3).Caption = "定位" Then' xscomm(3).Caption = "查找"' xscomm(0).Enabled = False' xscomm(8).Enabled = False' xstext(0).Refresh' aa (False)' xscomm(3).Enabled = True' Elsestrs1 = "请输入学号" + Chr(13) + Chr(10) + "然后单击确定"xhdw = InputBox$(strs1, "学号输入框", , 100, 100)If xhdw <> "" ThenAdodc1.Recordset.Filter = "sno like " & xhdw & ""If Adodc1.Recordset.EOF = True ThenMsgBox ("对不起,没找到!")Adodc1.RefreshEnd If'xscomm(0).Enabled = True' xscomm(8).Enabled = True' aa (True)' xscomm(3).Caption = "定位"' End IfEnd IfEnd IfCase 4If Adodc1.Recordset.RecordCount <> 0 ThenAdodc1.Recordset.MoveFirstEnd IfCase 5If Adodc1.Recordset.RecordCount <> 0 ThenAdodc1.Recordset.MoveLastEnd IfCase 6If Adodc1.Recordset.RecordCount <> 0 ThenAdodc1.Recordset.MovePreviousEnd IfCase 7If Adodc1.Recordset.RecordCount <> 0 ThenAdodc1.Recordset.MoveNextEnd IfCase 8If xscomm(8).Caption = "放弃" Thenxscomm(0).Caption = "新增"xscomm(8).Caption = "退出"Adodc1.Recordset.CancelUpdateAdodc1.Refreshaa (True)xscomm(0).SetFocusElsexsxxgl.Enabled = Falsexsxxgl.Visible = FalseAdodc1.Enabled = Falsexxgl.Enabled = Truecxtj.Enabled = TrueBBDY.Enabled = Truextwh.Enabled = Truetcxt.Enabled = TrueEnd IfEnd Select'xxts:' MsgBox ("输入数据非法或者是学号重复")End SubPrivate Sub aa(l As Boolean)Dim otxt As TextBoxIf xsxxgl.Enabled = True ThenFor Each otxt In xstextotxt.Locked = lNextxscomm(1).Enabled = lxscomm(2).Enabled = lxscomm(3).Enabled = lxscomm(4).Enabled = lxscomm(5).Enabled = lxscomm(6).Enabled = lxscomm(7).Enabled = l' xscomm(0).SetFocusEnd IfIf scorefram.Enabled = True ThenFor Each otxt In cjtextotxt.Locked = lNextcjcomm(1).Enabled = lcjcomm(2).Enabled = lcjcomm(3).Enabled = lcjcomm(4).Enabled = lcjcomm(5).Enabled = lcjcomm(6).Enabled = lcjcomm(7).Enabled = lcjcomm(0).SetFocusEnd IfIf coursefram.Enabled = True ThenFor Each otxt In coursetextotxt.Locked = lNextcoursecomm(1).Enabled = lcoursecomm(2).Enabled = lcoursecomm(3).Enabled = lcoursecomm(4).Enabled = lcoursecomm(5).Enabled = lcoursecomm(6).Enabled = lcoursecomm(7).Enabled = lcoursecomm(0).SetFocusEnd IfEnd SubPrivate Sub xscx_Click(Index As Integer)Dim cxstr As StringSelect Case IndexCase 0cxstr = ""If xscxcheck(0).Value = 1 ThenIf cxstr <> "" Thencxstr = cxstr + " and ((strcomp(sno," & xscxtext(0).Text & ")=0 or strcomp(sno," & xscxtext(0).Text & ")=1)) and ((strcomp(sno," & xscxtext(1).Text & ")=0 or strcomp(sno," & xscxtext(1).Text & ")=-1))"Elsecxstr = cxstr + " ((strcomp(sno," & xscxtext(0).Text & ")=0 or strcomp(sno," & xscxtext(0).Text & ")=1)) and ((strcomp(sno," & xscxtext(1).Text & ")=0 or strcomp(sno," & xscxtext(1).Text & ")=-1))"End IfEnd IfIf xscxcheck(1).Value = 1 ThenIf cxstr <> "" Thencxstr = cxstr + " and ( sname like " & xscxtext(2).Text & ")"Elsecxstr = cxstr + " ( strcomp(sname, " & xscxtext(2).Text & "))"End IfEnd IfIf xscxcheck(2).Value = 1 ThenIf cxstr <> "" Thencxstr = cxstr + " and (sclass like " & xscxtext(3).Text & ")"Elsecxstr = cxstr + " (sclass like " & xscxtext(3).Text & ")"End IfEnd IfIf cxstr <> "" ThenAdodc1.RecordSource = "select * from student where " & cxstr & " order by sno"ElseAdodc1.RecordSource = "select * from student order by sno"End IfAdodc1.Refreshcxstr = ""Case 1cxjgfram.Enabled = Falsecxjgfram.Visible = Falsexscxfram.Enabled = Falsexscxfram.Visible = Falsexxgl.Enabled = Truecxtj.Enabled = TrueBBDY.Enabled = Truextwh.Enabled = Truetcxt.Enabled = TrueEnd SelectEnd SubPrivate Sub xscxcheck_Click(Index As Integer)Select Case IndexCase 0If xscxcheck(0).Value = 0 Thenxscxtext(0).BackColor = &H8000000Fxscxtext(0).Text = ""xscxtext(0).Enabled = Falsexscxtext(1).BackColor = &H8000000Fxscxtext(1).Text = ""xscxtext(1).Enabled = FalseElsexscxtext(0).Enabled = Truexscxtext(0).BackColor = &H80000005xscxtext(1).Enabled = Truexscxtext(1).BackColor = &H80000005xscxtext(0).SetFocusEnd IfCase 1If xscxcheck(1).Value = 0 Thenxscxtext(2).BackColor = &H8000000Fxscxtext(2).Text = ""xscxtext(2).Enabled = FalseElsexscxtext(2).Enabled = Truexscxtext(2).BackColor = &H80000005xscxtext(2).SetFocusEnd IfCase 2If xscxcheck(2).Value = 0 Thenxscxtext(3).BackColor = &H8000000Fxscxtext(3).Text = ""xscxtext(3).Enabled = FalseElsexscxtext(3).Enabled = Truexscxtext(3).BackColor = &H80000005xscxtext(3).SetFocusEnd IfEnd SelectEnd SubPrivate Sub xstext_KeyPress(Index As Integer, KeyAscii As Integer)If KeyAscii = 13 ThenSelect Case IndexCase 0xstext(1).SetFocusCase 1xbcheck.SetFocusCase 2, 3xstext(Index + 1).SetFocusCase 4xscomm(0).SetFocusEnd SelectEnd IfEnd SubPrivate Sub xsxx_Click()Dim str As Stringxsxxgl.Visible = Truexsxxgl.Enabled = TrueAdodc1.Enabled = TrueAdodc1.Enabled = Truestr = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=d:\xscjglxt\cjgl.mdb"Adodc1.ConnectionString = strAdodc1.CommandType = adCmdTextAdodc1.RecordSource = "select * from student"Adodc1.Refreshxstext(0).DataField = "sno"xstext(1).DataField = "sname"xbcheck.DataField = "ssex"xstext(2).DataField = "sfrom"xstext(3).DataField = "sclass"xstext(4).DataField = "smemo"scorefram.Visible = Falsescorefram.Enabled = FalseEnd SubPrivate Sub xxcx_Click(Index As Integer)Dim str As StringDim cxstr As Stringxxgl.Enabled = Falsecxtj.Enabled = FalseBBDY.Enabled = Falsextwh.Enabled = Falsetcxt.Enabled = FalseAdodc1.Enabled = Truestr = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=d:\xscjglxt\cjgl.mdb"Adodc1.ConnectionString = strAdodc1.CommandType = adCmdTextcxjgfram.Enabled = Truecxjgfram.Visible = Truecxjgfram.Top = 0cxjgfram.Height = 3135cxjgfram.Left = 120cxjgfram.Width = 8655cxjggrid.AllowUpdate = Falsecxstr = ""Select Case IndexCase 0kccxfram.Enabled = Truekccxfram.Visible = Truekccxfram.Top = 3120kccxfram.Height = 2535kccxfram.Left = 120kccxfram.Width = 8655Adodc1.RecordSource = "select * from course"Adodc1.RefreshCase 1xscxfram.Enabled = Truexscxfram.Visible = Truexscxfram.Top = 3120xscxfram.Height = 2535xscxfram.Left = 120xscxfram.Width = 8655Adodc1.RecordSource = "select * from student"Adodc1.RefreshCase 2cjcxfram.Enabled = Truecjcxfram.Visible = Truecjcxfram.Top = 3120cjcxfram.Height = 2535cjcxfram.Left = 120cjcxfram.Width = 8655Adodc1.RecordSource = "select * from score"Adodc1.RefreshEnd SelectEnd SubPrivate Sub xxlr_Click(Index As Integer)Dim i As LongDim j As LongDim qrl As StringDim num As LongDim ls As BooleanDim lssno As StringDim lscno As StringDim str As StringDim xsjl As BooleanDim kcjl As BooleanDim cjjl As BooleanDim dbs As DatabaseDim xskc As RecordsetDim xskcqdf As QueryDefxxgl.Enabled = Falsecxtj.Enabled = FalseBBDY.Enabled = Falsextwh.Enabled = Falsetcxt.Enabled = FalseAdodc1.Enabled = True'Adodc2.Enabled = Truestr = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=d:\xscjglxt\cjgl.mdb"Adodc1.ConnectionString = str'Adodc2.ConnectionString = strAdodc1.CommandType = adCmdText'Adodc2.CommandType = adCmdTextSelect Case IndexCase 0xsxxgl.Visible = Truexsxxgl.Enabled = Truexsxxgl.Height = 5895xsxxgl.Left = 120xsxxgl.Top = 0xsxxgl.Width = 8655Adodc1.RecordSource = "select * from student"Adodc1.Refreshxstext(0).DataField = "sno"xstext(1).DataField = "sname"xbcheck.DataField = "ssex"xstext(2).DataField = "sfrom"xstext(3).DataField = "sclass"xstext(4).DataField = "smemo"Case 1coursefram.Visible = Truecoursefram.Enabled = Truecoursefram.Height = 5895coursefram.Left = 120coursefram.Top = 0coursefram.Width = 8655Adodc1.RecordSource = "select * from course"Adodc1.Refreshcoursetext(0).DataField = "cno"coursetext(1).DataField = "cname"coursetext(2).DataField = "ctest"coursetext(3).DataField = "ctime"coursetext(4).DataField = "cscore"coursetext(5).DataField = "cteam"coursetext(6).DataField = "cmemo"Case 2cjlrgl.Enabled = Truecjlrgl.Visible = Truecjlrfram.Enabled = Truecjlrfram.Visible = Truecjlrfram.Top = 0cjlrfram.Height = 3135cjlrfram.Left = 120cjlrfram.Width = 8655cjlrgl.Top = 3120cjlrgl.Height = 2535cjlrgl.Left = 120cjlrgl.Width = 8655qrl = MsgBox("要更新数据吗?", vbOKCancel)If qrl = 1 Theni = 0j = 0Adodc1.RecordSource = "select student.sno,o from student,course order by student.sno,o"Adodc1.Refreshnum = Adodc1.Recordset.RecordCountAdodc1.Recordset.MoveFirstDo While j < num - 1lssno = Adodc1.Recordset.Fields(0)lscno = Adodc1.Recordset.Fields(0)Adodc1.RecordSource = "select * from score"Adodc1.RefreshIf Adodc1.Recordset.RecordCount <> 0 ThenAdodc1.Recordset.Filter = "(sno like " & lssno & ") and (cno like " & lscno & ")"End IfIf Adodc1.Recordset.EOF = True ThenAdodc1.RefreshAdodc1.Recordset.AddNewAdodc1.Recordset.Fields(0) = lssnoAdodc1.Recordset.Fields(1) = lscnoAdodc1.Recordset.UpdateBatchEnd Ifj = j + 1Adodc1.RecordSource = "select student.sno,o from student,course order by student.sno,o"Adodc1.RefreshAdodc1.Recordset.MoveFirsti = jDo While i > 0Adodc1.Recordset.MoveNexti = i - 1LoopLoopAdodc1.RecordSource = "select student.sno,o from student,course order by student.sno,o"Adodc1.RefreshAdodc1.Recordset.MoveLastlssno = Adodc1.Recordset.Fields(0)lscno = Adodc1.Recordset.Fields(1)Adodc1.RecordSource = "select * from score"Adodc1.RefreshAdodc1.Recordset.Filter = "sno like " & lssno & " and cno like " & lscno & ""If Adodc1.Recordset.EOF = True ThenAdodc1.RefreshAdodc1.Recordset.AddNewAdodc1.Recordset.Fields(0) = lssnoAdodc1.Recordset.Fields(1) = lscnoAdodc1.Recordset.UpdateBatchEnd Ifls = TrueDo While lsAdodc1.RecordSource = "select score.sno from score where score.sno not in (select student.sno from student) "Adodc1.RefreshIf Adodc1.Recordset.RecordCount <> 0 ThenAdodc1.Recordset.MoveFirstlssno = Adodc1.Recordset.Fields(0)Elsels = FalseEnd IfIf ls ThenAdodc1.Recordset.Filter = "sno like " & lssno & ""If Adodc1.Recordset.EOF = False ThenAdodc1.Recordset.MoveNextAdodc1.Recordset.MovePreviousAdodc1.Recordset.DeleteAdodc1.RefreshEnd IfEnd IfLoopDo While lsAdodc1.RecordSource = "select o from score where o not in (select o from course)"Adodc1.RefreshIf Adodc1.Recordset.RecordCount <> 0 ThenAdodc1.Recordset.MoveFirstlscno = Adodc1.Recordset.Fields(0)Elsels = FalseEnd IfIf ls ThenAdodc1.Recordset.Filter = "cno like " & lscno & ""If Adodc1.Recordset.EOF = False ThenAdodc1.Recordset.MoveNextAdodc1.Recordset.MovePreviousAdodc1.Recordset.DeleteAdodc1.RefreshEnd IfEnd IfLoopElseEnd IfAdodc1.RecordSource = "select * from score order by sno"Adodc1.RefreshEnd Selectaa (True)End Sub 展开更多...... 收起↑ 资源列表 成绩管理系统.doc 程序源代码.doc