VB+SQL Server智能排课系统 第10页
xlsheet.Cells(9, 8) = coursetemprst.Fields("coursename")
xlsheet.Cells(10, 8) = classroomrst.Fields("classroomName")
xlsheet.Cells(12, 8) = classtemprst.Fields("classname")
Case Is = 22
xlsheet.Cells(13, 8) = coursetemprst.Fields("coursename")
xlsheet.Cells(14, 8) = classroomrst.Fields("classroomName")
xlsheet.Cells(16, 8) = classtemprst.Fields("classname")
Case Is = 23
xlsheet.Cells(17, 8) = coursetemprst.Fields("coursename")
xlsheet.Cells(18, 8) = classroomrst.Fields("classroomName")
xlsheet.Cells(20, 8) = classtemprst.Fields("classname")
Case Is = 24
xlsheet.Cells(21, 8) = coursetemprst.Fields("coursename")
xlsheet.Cells(22, 8) = classroomrst.Fields("classroomName")
xlsheet.Cells(24, 8) = classtemprst.Fields("classname")
Case Is = 25
xlsheet.Cells(9, 9) = coursetemprst.Fields("coursename")
xlsheet.Cells(10, 9) = classroomrst.Fields("classroomName")
xlsheet.Cells(12, 9) = classtemprst.Fields("classname")
Case Is = 26
xlsheet.Cells(13, 9) = coursetemprst.Fields("coursename")
xlsheet.Cells(14, 9) = classroomrst.Fields("classroomName")
xlsheet.Cells(16, 9) = classtemprst.Fields("classname")
Case Is = 27
xlsheet.Cells(17, 9) = coursetemprst.Fields("coursename")
xlsheet.Cells(18, 9) = classroomrst.Fields("classroomName")
xlsheet.Cells(20, 9) = classtemprst.Fields("classname")
Case Is = 28
xlsheet.Cells(21, 9) = coursetemprst.Fields("coursename")
xlsheet.Cells(22, 9) = classroomrst.Fields("classroomName")
xlsheet.Cells(24, 9) = classtemprst.Fields("classname")
Case Else
MsgBox "数据溢出,请检查系统!"
End Select
i = i - 1
rst.MoveNext
Wend
教室课程表是为了方便查询某一确定教室是否有课,确定是哪个班上课,而且方便无课的学生选择自修的教室。查询教室课程表的界面如下:
图5-7 教室课程表查询界面
Chart 5-7 Interface of inquire classroom table
点击“查询课程表”就会立即生成教室课程表。其主要的代码如下:
Private Sub Command1_Click()
Dim strClassID As String
Dim i As Integer
strsql = "SELECT * FROM bTempTableA where classroomid= " & Text1.Text & " order by ttime"
strclasssql = "select classID,classname from bclass"
ConenctToDatabase
rst.Open strsql, db, adOpenKeyset, adLockOptimistic
temp.Open strclasssql, db, adOpenKeyset, adLockReadOnly
If rst.RecordCount() <> 0 Then
i = rst.RecordCount()
Else
MsgBox "无此信息,请重新输入!"
rst.Close
temp.Close
Exit Sub
End If
Set xlapp = New Excel.Application
Set xlbook = xlapp.Workbooks.Open(App.Path & "\课程表模板.xlt")
xlapp.Visible = True
Set xlsheet = xlbook.Worksheets("教室课程表")
xlsheet.Activate
xlsheet.Cells(5, 1) = DataGrid1.Columns(1).Text
xlsheet.Cells(5, 6) = Date
While i <> 0
strClassID = rst.Fields("classID")
temp.Filter = "classID = '" & strClassID & "'"
Select Case rst.Fields("Ttime")
Case Is = 1
xlsheet.Cells(9, 3) = temp.Fields("classname")
Case Is = 2
xlsheet.Cells(13, 3) = temp.Fields("classname")
Case Is = 3
xlsheet.Cells(17, 3) = temp.Fields("classname")
Case Is = 4
xlsheet.Cells(21, 3) = temp.Fields("classname")
Case Is = 5
xlsheet.Cells(9, 4) = temp.Fields("classname")
Case Is = 6
xlsheet.Cells(13, 4) = temp.Fields("classname")
Case Is = 7
xlsheet.Cells(17, 4) = temp.Fields("classname")
Case Is = 8
xlsheet.Cells(21, 4) = temp.Fields("classname")
Case Is = 9
xlsheet.Cells(9, 5) = temp.Fields("classname")
Case Is = 10
xlsheet.Cells(13, 5) = temp.Fields("classname")
Case Is = 11
xlsheet.Cells(17, 5) = temp.Fields("classname")
Case Is = 12
xlsheet.Cells(21, 5) = temp.Fields("classname")
Case Is = 13
xlsheet.Cells(9, 6) = temp.Fields("classname")
Case Is = 14
xlsheet.Cells(13, 6) = temp.Fields("classname")
Case Is = 15
xlsheet.Cells(17, 6) = temp.Fields("classname")
Case Is = 16
xlsheet.Cells(21, 6) = temp.Fields("classname")
Case Is = 17
xlsheet.Cells(9, 7) = temp.Fields("classname")
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] ... 下一页 >>