参考代码,生成对应的选择给学生,学生根据情况去上课。
不然,你要说明分配的逻辑,因为有多种可能符合,你要选择哪种?
Dim t1 As Table = Tables("学生选课表")
Dim t2 As DataTable = DataTables("课表")
'Dim dr As Row = t1.Current
For Each dr As Row In t1.Rows
For i As Integer = 5 To 9
dr("第" & i & "节") = Nothing
Next
For Each kc As String In dr("走班课程").split("|")
If kc.EndsWith("E") = False Then
For Each fdr As DataRow In t2.Select("科目='" & kc & "'")
If fdr IsNot Nothing Then
For i As Integer = 5 To 9
If fdr.IsNull("第" & i & "节") = False Then
Dim str = dr("第" & i & "节")
str &= "," & fdr("第" & i & "节") '& "(" & fdr("教师") & ")"
dr("第" & i & "节")= str.trim(",")
End If
Next
End If
Next
End If
Next
Next