临沂市 成绩系统管理(本科论文答辨用)[下学期]

文档属性

名称 临沂市 成绩系统管理(本科论文答辨用)[下学期]
格式 zip
文件大小 65.7KB
资源类型 教案
版本资源 通用版
科目 信息技术(信息科技)
更新时间 2007-09-08 18:56:00

文档简介

成绩管理系统说明书
运行环境:
本软件需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 Then
MsgBox ("记录已经超出范围")
Adodc1.Recordset.MoveFirst
End If
End Sub
'成绩查询框中的条件复选来选定对应的输入框,选中则使文本框有效,否则无效。
Private Sub cjcxcheck_Click(Index As Integer)
Select Case Index
Case 0
If cjcxcheck(0).Value = 1 Then
cjcxtext(0).BackColor = &H80000005
cjcxtext(0).Enabled = True
Else
cjcxtext(0).BackColor = &H8000000F
cjcxtext(0).Enabled = False
End If
Case 1
If cjcxcheck(1).Value = 1 Then
cjcxtext(1).BackColor = &H80000005
cjcxtext(1).Enabled = True
Else
cjcxtext(1).BackColor = &H8000000F
cjcxtext(1).Enabled = False
End If
Case 2
If cjcxcheck(2).Value = 1 Then
cjcxtext(2).BackColor = &H80000005
cjcxtext(2).Enabled = True
Else
cjcxtext(2).BackColor = &H8000000F
cjcxtext(2).Enabled = False
End If
End Select
End Sub
Private Sub cjcxcomm_Click(Index As Integer)
Dim cjtj As String
Select Case Index
Case 0
If cjcxcheck(0).Value = 1 Then
If cjtj <> "" Then
cjtj = cjtj + " and (sclass like " & cjcxtext(0).Text & ")"
Else
cjtj = cjtj + " (sclass like " & cjcxtext(0).Text & ")"
End If
End If
If cjcxcheck(1).Value = 1 Then
If cjtj <> "" Then
cjtj = cjtj + " and (o like " & cjcxtext(1).Text & " )"
Else
cjtj = cjtj + " (strcomp(o, " & cjcxtext(1).Text & " )=0)"
End If
End If
If cjcxcheck(2).Value = 1 Then
If cjtj <> "" Then
cjtj = cjtj + " and (cteam like " & cjcxtext(2).Text & " ) "
Else
cjtj = cjtj + " (cteam like " & cjcxtext(2).Text & " ) "
End If
End If
If cjtj <> "" Then
Adodc1.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 & " "
Else
Adodc1.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 If
Adodc1.Refresh
Case 1
Case 2
Case 3
Case 4
cxjgfram.Visible = False
cxjgfram.Enabled = False
cjcxfram.Visible = False
cjcxfram.Enabled = False
xxgl.Enabled = True
BBDY.Enabled = True
xtwh.Enabled = True
tcxt.Enabled = True
cxtj.Enabled = True
End Select
End Sub
Private Sub cjlrcheck_Click(Index As Integer)
Select Case Index
Case 0
If cjlrcheck(0).Value = 1 Then
cjlrtext(0).BackColor = &H80000005
cjlrtext(0).Enabled = True
Else
cjlrtext(0).BackColor = &H8000000F
cjlrtext(0).Enabled = False
End If
Case 1
If cjlrcheck(1).Value = 1 Then
cjlrtext(1).BackColor = &H80000005
cjlrtext(1).Enabled = True
cjlrtext(2).BackColor = &H80000005
cjlrtext(2).Enabled = True
Else
cjlrtext(1).BackColor = &H8000000F
cjlrtext(1).Enabled = False
cjlrtext(2).BackColor = &H8000000F
cjlrtext(2).Enabled = False
End If
Case 2
If cjlrcheck(2).Value = 1 Then
cjlrtext(3).BackColor = &H80000005
cjlrtext(3).Enabled = True
Else
cjlrtext(3).BackColor = &H8000000F
cjlrtext(3).Enabled = False
End If
End Select
End Sub
Private Sub cjlrcomm_Click(Index As Integer)
Dim gltj As String
Select Case Index
Case 0
gltj = ""
If cjlrcheck(0).Value = 1 Then
If gltj <> "" Then
gltj = gltj + " and (sclass like " & cjlrtext(0).Text & ")"
Else
gltj = gltj + " (sclass like " & cjlrtext(0).Text & ")"
End If
End If
If cjlrcheck(1).Value = 1 Then
If gltj <> "" Then
gltj = 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))"
Else
bltj = 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 If
End If
If cjlrcheck(2).Value = 1 Then
If gltj <> "" Then
gltj = gltj + " and (cteam like " & cjlrtext(3).Text & ")"
Else
gltj = gltj + " (cteam like " & cjlrtext(3).Text & ")"
End If
End If
If gltj = "" Then
Adodc1.RecordSource = "select score.* from student,course,score where (student.sno=score.sno) and (o=o) "
Else
Adodc1.RecordSource = "select score.* from student,course,score where (student.sno=score.sno) and (o=o) and " & gltj & ""
End If
Adodc1.Refresh
Case 1
cjlrgl.Visible = False
cjlrfram.Enabled = False
cjlrfram.Visible = False
cjlrgl.Enabled = False
xxgl.Enabled = True
cxtj.Enabled = True
BBDY.Enabled = True
xtwh.Enabled = True
tcxt.Enabled = True
End Select
End Sub
Private Sub cjlrtext_KeyPress(Index As Integer, KeyAscii As Integer)
Select Case Index
Case 0
If KeyAscii = 13 Then
cjlrcomm(0).SetFocus
End If
Case 1
If KeyAscii = 13 Then
cjlrtext(2).SetFocus
End If
Case 2
If KeyAscii = 13 Then
cjlrcomm(0).SetFocus
End If
Case 3
If KeyAscii = 13 Then
cjlrcomm(0).SetFocus
End If
End Select
End Sub
Private Sub coursecomm_Click(Index As Integer)
Dim strs1 As String
Dim cjdw As String
Dim qrl As Integer
Dim ls As Boolean
Dim lscno As String
Dim lsname As String
Dim lstest As String
Dim lstime As String
Dim lsgrade As String
Dim lsteam As String
Dim lsmemo As String
Select Case Index
Case 0
If coursecomm(0).Caption = "新增" Then
coursecomm(0).Caption = "保存"
coursecomm(8).Caption = "放弃"
Adodc1.Recordset.AddNew
'ls = False
aa (False)
coursetext(0).SetFocus
Else
'Adodc1.Recordset.Filter = "cno like " & coursetext(0).Text & ""
'If Adodc1.Recordset.EOF = True Then
coursecomm(0).Caption = "新增"
coursecomm(8).Caption = "退出"
Adodc1.Recordset.UpdateBatch 'adAffectAll
aa (True)
'Else
'MsgBox ("课程号重复,请重复输入!")
'coursetext(O).SetFocus
'End If
End If
Case 1
If Adodc1.Recordset.RecordCount <> 0 Then
qrl = MsgBox("确实要删除该记录吗", vbOKCancel)
If qrl = 2 Then
Exit Sub
End If
Adodc1.Recordset.Delete
Adodc1.Refresh
End If
Case 2
If Adodc1.Recordset.RecordCount <> 0 Then
coursecomm(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 = True
aa (False)
End If
Case 3
If Adodc1.Recordset.RecordCount <> 0 Then
strs1 = "请输入课程号" + Chr(13) + Chr(10) + "然后单击确定"
cjdw = InputBox$(strs1, "课程号输入框", , 100, 100)
If cjdw <> "" Then
Adodc1.Recordset.Filter = "cno like " & cjdw & ""
If Adodc1.Recordset.EOF = True Then
MsgBox ("对不起,没找到!")
Adodc1.Refresh
End If
End If
End If
Case 4
If Adodc1.Recordset.RecordCount <> 0 Then
Adodc1.Recordset.MoveFirst
End If
Case 5
If Adodc1.Recordset.RecordCount <> 0 Then
Adodc1.Recordset.MoveLast
End If
Case 6
If Adodc1.Recordset.RecordCount <> 0 Then
Adodc1.Recordset.MovePrevious
End If
Case 7
If Adodc1.Recordset.RecordCount <> 0 Then
Adodc1.Recordset.MoveNext
End If
Case 8
If coursecomm(8).Caption = "退出" Then
coursefram.Visible = False
coursefram.Enabled = False
Adodc1.Enabled = False
xxgl.Enabled = True
cxtj.Enabled = True
BBDY.Enabled = True
xtwh.Enabled = True
tcxt.Enabled = True
Else
coursecomm(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
' Else
Adodc1.Recordset.CancelUpdate
'End If
Adodc1.Refresh
aa (True)
coursecomm(0).SetFocus
End If
End Select
End Sub
Private Sub coursetext_KeyPress(Index As Integer, KeyAscii As Integer)
If KeyAscii = 13 Then
Select Case Index
Case 0, 1, 2
coursetext(Index + 1).SetFocus
Case 3, 4
coursetext(Index + 1).SetFocus
If IsNumeric(coursetext(Index)) Then
Else
MsgBox ("输入的数据非法,请重新输入!")
coursetext(Index).SetFocus
End If
Case 5
coursetext(Index + 1).SetFocus
Case 6
coursecomm(0).SetFocus
End Select
End If
End Sub
Private Sub Form_Load()
xsxxgl.Enabled = False
xsxxgl.Visible = False
scorefram.Enabled = False
scorefram.Visible = False
coursefram.Enabled = False
coursefram.Visible = False
cxjgfram.Enabled = False
cxjgfram.Visible = False
kccxfram.Enabled = False
kccxfram.Visible = fasle
xscxfram.Enabled = False
xscxfram.Visible = False
cjlrfram.Enabled = False
cjlrfram.Visible = False
cjlrgl.Enabled = False
cjlrgl.Visible = False
cjcxfram.Visible = False
cjcxfram.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 If
End Sub
Private Sub kccx_Click(Index As Integer)
Dim cxstr As String
If kccxcheck(0).Value = 1 Then
If cxstr <> "" Then
cxstr = 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 )"
Else
cxstr = 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 If
End If
If kccxcheck(1).Value = 1 Then
If cxstr <> "" Then
cxstr = cxstr + " and ( cname like " & kccxtext(2).Text & " ) "
Else
cxstr = cxstr + "( cname like " & kccxtext(2).Text & " ) "
End If
End If
If kccxcheck(2).Value = 1 Then
If cxstr <> "" Then
cxstr = cxstr + " and ( cteam like " & kccxtext(3).Text & " ) "
Else
cxstr = cxstr + " ( cteam like " & kccxtext(3).Text & " ) "
End If
End If
Select Case Index
Case 0
If cxstr = "" Then
Adodc1.RecordSource = "select * from course"
Else
Adodc1.RecordSource = "select * from course where " & cxstr & "" 'cno>=0 and & cxstr & order by cno"
End If
Adodc1.Refresh
cxstr = ""
Case 1
kccxfram.Enabled = False
kccxfram.Visible = False
cxjgfram.Enabled = False
cxjgfram.Visible = False
xxgl.Enabled = True
cxtj.Enabled = True
BBDY.Enabled = True
xtwh.Enabled = True
tcxt.Enabled = True
End Select
End Sub
Private Sub kccxcheck_Click(Index As Integer)
Select Case Index
Case 0
If kccxcheck(0).Value = 0 Then
kccxtext(0).BackColor = &H8000000F
kccxtext(0).Text = ""
kccxtext(0).Enabled = False
kccxtext(1).BackColor = &H8000000F
kccxtext(1).Text = ""
kccxtext(1).Enabled = False
Else
kccxtext(0).Enabled = True
kccxtext(0).BackColor = &H80000005
kccxtext(1).Enabled = True
kccxtext(1).BackColor = &H80000005
End If
Case 1
If kccxcheck(1).Value = 0 Then
kccxtext(2).BackColor = &H8000000F
kccxtext(2).Text = ""
kccxtext(2).Enabled = False
Else
kccxtext(2).Enabled = True
kccxtext(2).BackColor = &H80000005
End If
Case 2
If kccxcheck(2).Value = 0 Then
kccxtext(3).BackColor = &H8000000F
kccxtext(3).Text = ""
kccxtext(3).Enabled = False
Else
kccxtext(3).Enabled = True
kccxtext(3).BackColor = &H80000005
End If
End Select
End Sub
Private Sub kccxtext_KeyPress(Index As Integer, KeyAscii As Integer)
Select Case Index
Case 0
If KeyAscii = 13 Then
kccxtext(1).SetFocus
End If
Case 1, 2, 3
If KeyAscii = 13 Then
kccx(0).SetFocus
End If
End Select
End Sub
Private Sub scorefram_DragDrop(Source As Control, X As Single, Y As Single)
cjcomm(0).SetFocus
End Sub
Private Sub sjwh_Click(Index As Integer)
Dim qrl As String
Dim str As String
Select Case Index
Case 0
Case 1
Case 2
qrl = MsgBox("真的要初始化数据吗?", vbOKCancel)
If qrl = 1 Then
str = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=d:\xscjglxt\cjgl.mdb"
Adodc1.ConnectionString = str
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select * from student"
Do While Adodc1.Recordset.RecordCount <> 0
Adodc1.Recordset.MoveFirst
Adodc1.Recordset.Delete
Adodc1.Refresh
Loop
Adodc1.RecordSource = "select * from course"
Do While Adodc1.Recordset.RecordCount <> 0
Adodc1.Recordset.MoveFirst
Adodc1.Recordset.Delete
Adodc1.Refresh
Loop
Adodc1.RecordSource = "select * from score"
Do While Adodc1.Recordset.RecordCount <> 0
Adodc1.Recordset.MoveFirst
Adodc1.Recordset.Delete
Adodc1.Refresh
Loop
End If
End Select
End Sub
Private Sub tcxt_Click()
Dim qrl As String
qrl = MsgBox("真的要退出系统吗?", vbOKCancel)
If qrl = 1 Then
End
End If
End Sub
Private Sub xbcheck_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
xstext(2).SetFocus
End If
End Sub
Private Sub xscomm_Click(Index As Integer)
'Dim xhdw As String
'Dim strs1 As String
'On Error GoTo xxts
Dim qrl As Integer
Select Case Index
Case 0
If xscomm(0).Caption = "新增" Then
xscomm(0).Caption = "保存"
xscomm(8).Caption = "放弃"
Adodc1.Recordset.AddNew
aa (False)
Else
xscomm(0).Caption = "新增"
xscomm(8).Caption = "退出"
Adodc1.Recordset.UpdateBatch adAffectAll
aa (True)
End If
Case 1
If Adodc1.Recordset.RecordCount <> 0 Then
xscomm(0).Caption = "保存"
xscomm(8).Caption = "放弃"
aa (False)
End If
Case 2
'If xscomm(2).Caption = "删除" Then
If Adodc1.Recordset.RecordCount <> 0 Then
qrl = MsgBox("确实要删除该记录吗", vbOKCancel)
If qrl = 2 Then
Exit Sub
End If
Adodc1.Recordset.Delete
Adodc1.Recordset.MoveNext
Adodc1.Refresh
End If
Case 3
If 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
' Else
strs1 = "请输入学号" + Chr(13) + Chr(10) + "然后单击确定"
xhdw = InputBox$(strs1, "学号输入框", , 100, 100)
If xhdw <> "" Then
Adodc1.Recordset.Filter = "sno like " & xhdw & ""
If Adodc1.Recordset.EOF = True Then
MsgBox ("对不起,没找到!")
Adodc1.Refresh
End If
'xscomm(0).Enabled = True
' xscomm(8).Enabled = True
' aa (True)
' xscomm(3).Caption = "定位"
' End If
End If
End If
Case 4
If Adodc1.Recordset.RecordCount <> 0 Then
Adodc1.Recordset.MoveFirst
End If
Case 5
If Adodc1.Recordset.RecordCount <> 0 Then
Adodc1.Recordset.MoveLast
End If
Case 6
If Adodc1.Recordset.RecordCount <> 0 Then
Adodc1.Recordset.MovePrevious
End If
Case 7
If Adodc1.Recordset.RecordCount <> 0 Then
Adodc1.Recordset.MoveNext
End If
Case 8
If xscomm(8).Caption = "放弃" Then
xscomm(0).Caption = "新增"
xscomm(8).Caption = "退出"
Adodc1.Recordset.CancelUpdate
Adodc1.Refresh
aa (True)
xscomm(0).SetFocus
Else
xsxxgl.Enabled = False
xsxxgl.Visible = False
Adodc1.Enabled = False
xxgl.Enabled = True
cxtj.Enabled = True
BBDY.Enabled = True
xtwh.Enabled = True
tcxt.Enabled = True
End If
End Select
'xxts:
' MsgBox ("输入数据非法或者是学号重复")
End Sub
Private Sub aa(l As Boolean)
Dim otxt As TextBox
If xsxxgl.Enabled = True Then
For Each otxt In xstext
otxt.Locked = l
Next
xscomm(1).Enabled = l
xscomm(2).Enabled = l
xscomm(3).Enabled = l
xscomm(4).Enabled = l
xscomm(5).Enabled = l
xscomm(6).Enabled = l
xscomm(7).Enabled = l
' xscomm(0).SetFocus
End If
If scorefram.Enabled = True Then
For Each otxt In cjtext
otxt.Locked = l
Next
cjcomm(1).Enabled = l
cjcomm(2).Enabled = l
cjcomm(3).Enabled = l
cjcomm(4).Enabled = l
cjcomm(5).Enabled = l
cjcomm(6).Enabled = l
cjcomm(7).Enabled = l
cjcomm(0).SetFocus
End If
If coursefram.Enabled = True Then
For Each otxt In coursetext
otxt.Locked = l
Next
coursecomm(1).Enabled = l
coursecomm(2).Enabled = l
coursecomm(3).Enabled = l
coursecomm(4).Enabled = l
coursecomm(5).Enabled = l
coursecomm(6).Enabled = l
coursecomm(7).Enabled = l
coursecomm(0).SetFocus
End If
End Sub
Private Sub xscx_Click(Index As Integer)
Dim cxstr As String
Select Case Index
Case 0
cxstr = ""
If xscxcheck(0).Value = 1 Then
If cxstr <> "" Then
cxstr = 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))"
Else
cxstr = 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 If
End If
If xscxcheck(1).Value = 1 Then
If cxstr <> "" Then
cxstr = cxstr + " and ( sname like " & xscxtext(2).Text & ")"
Else
cxstr = cxstr + " ( strcomp(sname, " & xscxtext(2).Text & "))"
End If
End If
If xscxcheck(2).Value = 1 Then
If cxstr <> "" Then
cxstr = cxstr + " and (sclass like " & xscxtext(3).Text & ")"
Else
cxstr = cxstr + " (sclass like " & xscxtext(3).Text & ")"
End If
End If
If cxstr <> "" Then
Adodc1.RecordSource = "select * from student where " & cxstr & " order by sno"
Else
Adodc1.RecordSource = "select * from student order by sno"
End If
Adodc1.Refresh
cxstr = ""
Case 1
cxjgfram.Enabled = False
cxjgfram.Visible = False
xscxfram.Enabled = False
xscxfram.Visible = False
xxgl.Enabled = True
cxtj.Enabled = True
BBDY.Enabled = True
xtwh.Enabled = True
tcxt.Enabled = True
End Select
End Sub
Private Sub xscxcheck_Click(Index As Integer)
Select Case Index
Case 0
If xscxcheck(0).Value = 0 Then
xscxtext(0).BackColor = &H8000000F
xscxtext(0).Text = ""
xscxtext(0).Enabled = False
xscxtext(1).BackColor = &H8000000F
xscxtext(1).Text = ""
xscxtext(1).Enabled = False
Else
xscxtext(0).Enabled = True
xscxtext(0).BackColor = &H80000005
xscxtext(1).Enabled = True
xscxtext(1).BackColor = &H80000005
xscxtext(0).SetFocus
End If
Case 1
If xscxcheck(1).Value = 0 Then
xscxtext(2).BackColor = &H8000000F
xscxtext(2).Text = ""
xscxtext(2).Enabled = False
Else
xscxtext(2).Enabled = True
xscxtext(2).BackColor = &H80000005
xscxtext(2).SetFocus
End If
Case 2
If xscxcheck(2).Value = 0 Then
xscxtext(3).BackColor = &H8000000F
xscxtext(3).Text = ""
xscxtext(3).Enabled = False
Else
xscxtext(3).Enabled = True
xscxtext(3).BackColor = &H80000005
xscxtext(3).SetFocus
End If
End Select
End Sub
Private Sub xstext_KeyPress(Index As Integer, KeyAscii As Integer)
If KeyAscii = 13 Then
Select Case Index
Case 0
xstext(1).SetFocus
Case 1
xbcheck.SetFocus
Case 2, 3
xstext(Index + 1).SetFocus
Case 4
xscomm(0).SetFocus
End Select
End If
End Sub
Private Sub xsxx_Click()
Dim str As String
xsxxgl.Visible = True
xsxxgl.Enabled = True
Adodc1.Enabled = True
Adodc1.Enabled = True
str = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=d:\xscjglxt\cjgl.mdb"
Adodc1.ConnectionString = str
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select * from student"
Adodc1.Refresh
xstext(0).DataField = "sno"
xstext(1).DataField = "sname"
xbcheck.DataField = "ssex"
xstext(2).DataField = "sfrom"
xstext(3).DataField = "sclass"
xstext(4).DataField = "smemo"
scorefram.Visible = False
scorefram.Enabled = False
End Sub
Private Sub xxcx_Click(Index As Integer)
Dim str As String
Dim cxstr As String
xxgl.Enabled = False
cxtj.Enabled = False
BBDY.Enabled = False
xtwh.Enabled = False
tcxt.Enabled = False
Adodc1.Enabled = True
str = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=d:\xscjglxt\cjgl.mdb"
Adodc1.ConnectionString = str
Adodc1.CommandType = adCmdText
cxjgfram.Enabled = True
cxjgfram.Visible = True
cxjgfram.Top = 0
cxjgfram.Height = 3135
cxjgfram.Left = 120
cxjgfram.Width = 8655
cxjggrid.AllowUpdate = False
cxstr = ""
Select Case Index
Case 0
kccxfram.Enabled = True
kccxfram.Visible = True
kccxfram.Top = 3120
kccxfram.Height = 2535
kccxfram.Left = 120
kccxfram.Width = 8655
Adodc1.RecordSource = "select * from course"
Adodc1.Refresh
Case 1
xscxfram.Enabled = True
xscxfram.Visible = True
xscxfram.Top = 3120
xscxfram.Height = 2535
xscxfram.Left = 120
xscxfram.Width = 8655
Adodc1.RecordSource = "select * from student"
Adodc1.Refresh
Case 2
cjcxfram.Enabled = True
cjcxfram.Visible = True
cjcxfram.Top = 3120
cjcxfram.Height = 2535
cjcxfram.Left = 120
cjcxfram.Width = 8655
Adodc1.RecordSource = "select * from score"
Adodc1.Refresh
End Select
End Sub
Private Sub xxlr_Click(Index As Integer)
Dim i As Long
Dim j As Long
Dim qrl As String
Dim num As Long
Dim ls As Boolean
Dim lssno As String
Dim lscno As String
Dim str As String
Dim xsjl As Boolean
Dim kcjl As Boolean
Dim cjjl As Boolean
Dim dbs As Database
Dim xskc As Recordset
Dim xskcqdf As QueryDef
xxgl.Enabled = False
cxtj.Enabled = False
BBDY.Enabled = False
xtwh.Enabled = False
tcxt.Enabled = False
Adodc1.Enabled = True
'Adodc2.Enabled = True
str = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=d:\xscjglxt\cjgl.mdb"
Adodc1.ConnectionString = str
'Adodc2.ConnectionString = str
Adodc1.CommandType = adCmdText
'Adodc2.CommandType = adCmdText
Select Case Index
Case 0
xsxxgl.Visible = True
xsxxgl.Enabled = True
xsxxgl.Height = 5895
xsxxgl.Left = 120
xsxxgl.Top = 0
xsxxgl.Width = 8655
Adodc1.RecordSource = "select * from student"
Adodc1.Refresh
xstext(0).DataField = "sno"
xstext(1).DataField = "sname"
xbcheck.DataField = "ssex"
xstext(2).DataField = "sfrom"
xstext(3).DataField = "sclass"
xstext(4).DataField = "smemo"
Case 1
coursefram.Visible = True
coursefram.Enabled = True
coursefram.Height = 5895
coursefram.Left = 120
coursefram.Top = 0
coursefram.Width = 8655
Adodc1.RecordSource = "select * from course"
Adodc1.Refresh
coursetext(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 2
cjlrgl.Enabled = True
cjlrgl.Visible = True
cjlrfram.Enabled = True
cjlrfram.Visible = True
cjlrfram.Top = 0
cjlrfram.Height = 3135
cjlrfram.Left = 120
cjlrfram.Width = 8655
cjlrgl.Top = 3120
cjlrgl.Height = 2535
cjlrgl.Left = 120
cjlrgl.Width = 8655
qrl = MsgBox("要更新数据吗?", vbOKCancel)
If qrl = 1 Then
i = 0
j = 0
Adodc1.RecordSource = "select student.sno,o from student,course order by student.sno,o"
Adodc1.Refresh
num = Adodc1.Recordset.RecordCount
Adodc1.Recordset.MoveFirst
Do While j < num - 1
lssno = Adodc1.Recordset.Fields(0)
lscno = Adodc1.Recordset.Fields(0)
Adodc1.RecordSource = "select * from score"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount <> 0 Then
Adodc1.Recordset.Filter = "(sno like " & lssno & ") and (cno like " & lscno & ")"
End If
If Adodc1.Recordset.EOF = True Then
Adodc1.Refresh
Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields(0) = lssno
Adodc1.Recordset.Fields(1) = lscno
Adodc1.Recordset.UpdateBatch
End If
j = j + 1
Adodc1.RecordSource = "select student.sno,o from student,course order by student.sno,o"
Adodc1.Refresh
Adodc1.Recordset.MoveFirst
i = j
Do While i > 0
Adodc1.Recordset.MoveNext
i = i - 1
Loop
Loop
Adodc1.RecordSource = "select student.sno,o from student,course order by student.sno,o"
Adodc1.Refresh
Adodc1.Recordset.MoveLast
lssno = Adodc1.Recordset.Fields(0)
lscno = Adodc1.Recordset.Fields(1)
Adodc1.RecordSource = "select * from score"
Adodc1.Refresh
Adodc1.Recordset.Filter = "sno like " & lssno & " and cno like " & lscno & ""
If Adodc1.Recordset.EOF = True Then
Adodc1.Refresh
Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields(0) = lssno
Adodc1.Recordset.Fields(1) = lscno
Adodc1.Recordset.UpdateBatch
End If
ls = True
Do While ls
Adodc1.RecordSource = "select score.sno from score where score.sno not in (select student.sno from student) "
Adodc1.Refresh
If Adodc1.Recordset.RecordCount <> 0 Then
Adodc1.Recordset.MoveFirst
lssno = Adodc1.Recordset.Fields(0)
Else
ls = False
End If
If ls Then
Adodc1.Recordset.Filter = "sno like " & lssno & ""
If Adodc1.Recordset.EOF = False Then
Adodc1.Recordset.MoveNext
Adodc1.Recordset.MovePrevious
Adodc1.Recordset.Delete
Adodc1.Refresh
End If
End If
Loop
Do While ls
Adodc1.RecordSource = "select o from score where o not in (select o from course)"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount <> 0 Then
Adodc1.Recordset.MoveFirst
lscno = Adodc1.Recordset.Fields(0)
Else
ls = False
End If
If ls Then
Adodc1.Recordset.Filter = "cno like " & lscno & ""
If Adodc1.Recordset.EOF = False Then
Adodc1.Recordset.MoveNext
Adodc1.Recordset.MovePrevious
Adodc1.Recordset.Delete
Adodc1.Refresh
End If
End If
Loop
Else
End If
Adodc1.RecordSource = "select * from score order by sno"
Adodc1.Refresh
End Select
aa (True)
End Sub
同课章节目录