【正文】
39。 amp。 39。 amp。, ) = Replace(Trim(), 39。 strSQL, Conn, 3, 3 End Sub Private Sub Form_Unload(Cancel As Integer) Set = Nothing Set rs = Nothing Set Conn = Nothing End Sub 考試成績管理 考試成績查詢 選擇課程編號、開課班級、能顯示相應(yīng)的班級信息,在此模塊可以添加和修改所選課程的成績。 amp。 AND =39。 If adStateClosed Then strSQL = SELECT , CourseName, ClassRoom, ClassDate, Credit, Period, Teacher FROM Course, CourseSelect strSQL = strSQL amp。 amp。 strSQL, Conn, 1, 1 If Not Then lblDepartName = rsClass(DepartName).Value lblMaster = rsClass(Master).Value lblBeginDate = Str(rsClass(BeginDate).Value) strSQL = SELECT Count(*) as StudentCount FROM Student WHERE ClassID=39。 amp。 AND ClassID=39。 strSQL, Conn, 1, 1 Set = rs With dgCourseSelect = Nothing Set rs = Nothing Set Conn = Nothing End Sub 班級課表 顯示班級的課表安排: 圖 45 班級課表界面 代碼實(shí)現(xiàn): Dim Conn As Dim WithEvents rs As 30 Private Sub cmbClass_Click() ClassInfo FullGrid End Sub Private Sub cmdQuit_Click() Unload Me End Sub Private Sub Form_Load() Set Conn = New Set rs = New ConnString FullClass cmbClass_Click End Sub Private Sub FullClass() Dim rsClass As Dim strSQL$ Set rsClass = New strSQL = SELECT * FROM Class strSQL, Conn, 1, 1 While Not rsClass(ClassID).Value Wend If 0 Then = 0 Set rsClass = Nothing End Sub Private Sub ClassInfo() Dim rsClass As Dim strSQL$ Set rsClass = New strSQL = SELECT Class.*, FROM Class, Department strSQL = strSQL amp。 amp。 AND =39。 FROM CourseSelect, Class strSQL = strSQL amp。 39。 amp。 39。 amp。 39。 amp。 39。 amp。 WHERE = strSQL = strSQL amp。 39。 amp。 WHERE = strSQL = strSQL amp。, ) If strClassRoom = Then MsgBox 上課教室沒有指定! , , 輸入錯誤 Exit Sub ElseIf strClassDate = Then MsgBox 上課時間沒有指定! , , 輸入錯誤 25 If 0 Then = 0 Set rsClass = Nothing End Sub Private Sub FullCourse() Dim rsCourse As Dim strSQL$ Set rsCourse = New strSQL = SELECT * FROM Course strSQL, Conn, 1, 1 While Not rsCourse(CourseID).Value Wend If 0 Then = 0 Set rsCourse = Nothing End Sub Private Sub FullGrid() If adStateClosed Then strSQL = SELECT , CourseName, ClassRoom, ClassDate, Credit, Period, Teacher strSQL = strSQL amp。 Set cmdUpdate = New Set = Conn = strSQL 24 Set cmdUpdate = Nothing FullGrid End Sub Private Sub cmdFirst_Click() If 0 Then End Sub Private Sub cmdLast_Click() If 0 Then End Sub Private Sub cmdModify_Click() If Or Then Exit Sub = rs(ClassRoom).Value = rs(ClassDate).Value = True End Sub Private Sub cmdNext_Click() If Not Then If And 0 Then End If End Sub Private Sub cmdPrevious_Click() If Not Then If And 0 Then End If End Sub Private Sub cmdQuit_Click() Unload Me End Sub Private Sub cmdSave_Click() Dim cmdUpdate As Dim strSQL$, strClassRoom$, strClassDate$ If Or Then Exit Sub strClassRoom = Replace(Trim(), 39。 rs(ID).Value amp。)。 strClassDate amp。,39。 strClassRoom amp。,39。 amp。,39。 amp。 VALUES(39。 39。 amp。 39。 amp。, ) strClassDate = Replace(Trim(), 39。在此處可以課程安排信息。 39。 amp。 39。 amp。 39。 amp。 39。 amp。 20 strSQL, Conn, 1, 1 If Not Then MsgBox 該課程編號已經(jīng)存在,請重新輸入! Set rsValid = Nothing Exit Sub End If Set rsValid = Nothing 39。 strCourseID amp。, ) If strCourseID = Then MsgBox 課程編號不能為空! , , 輸入錯誤 Exit Sub ElseIf strCourseName = Then MsgBox 課程名稱不能為空! , , 輸入錯誤 Exit Sub ElseIf intCredit = 0 Then MsgBox 該課程學(xué)分不能為空! , , 輸入錯誤 Exit Sub ElseIf intPeriod = 0 Then MsgBox 該課程學(xué)時數(shù)不能為空! , , 輸入錯誤 Exit Sub ElseIf strTeacher = Then MsgBox 任課老師不能為空! , , 輸入錯誤 Exit Sub End If If strCourseID rs(CourseID) Then Set rsValid = New strSQL = SELECT * FROM Course WHERE CourseID=39。, ) intCredit = Val() intPeriod = Val() strTeacher = Replace(Trim(), 39。 strSQL, Conn, 1, 1 If Not Then MsgBox 該課程編號已經(jīng)存在,請重新輸入! Set rsValid = Nothing Exit Sub End If Set rsValid = Nothing BookMK = rs(CourseID).Value = strCourseID rs(CourseName).Value = strCourseName rs(Credit).Value = intCredit rs(Period).Value = intPeriod rs(Teacher).Value = strTeacher rs(Description).Value = strDesc = True End If End Sub Private Sub cmdNext_Click() If Not Then If And 0 Then End If End Sub 19 Private Sub cmdPrevious_Click() If Not Then If And 0 Then End If End Sub Private Sub cmdQuit_Click() Unload Me End Sub Private Sub cmdSave_Click() Dim rsValid As Dim cmdUpdate As Dim strSQL$, strCourseID$, strCourseName$, intCredit!, intPeriod!, strTeacher$, strDesc$ strCourseID = Replace(Trim(), 39。 strCourseID amp。, ) If strCourseID = Then MsgBox 課程編號不能為空! , , 輸入錯誤 Exit Sub ElseIf strCourseName = Then MsgBox 課程名稱不能為空! , , 輸入錯誤 Exit Sub 18 ElseIf intCredit = 0 Then MsgBox 該課程學(xué)分不能為空! , , 輸入錯誤 Exit Sub ElseIf intPeriod = 0 Then MsgBox 該課程學(xué)時數(shù)不能為空! , , 輸入錯誤 Exit Sub ElseIf strTeacher = Then MsgBox 任課老師不能為空! , , 輸入錯誤 Exit Sub End If Set rsValid = New strSQL = SELECT * FROM Course WHERE CourseID=39。, ) intCredit = Val() intPeriod = Val() strTeacher = Replace(Trim(), 39。 17 圖 43 課程管理界面 代碼實(shí)現(xiàn): Dim Conn As Dim WithEvents rs As Private Sub cmdAdd_