Dim xh As List(Of String) = DataTables("0000").GetValues("学号") '取得所有不重复学号
For Each xm As String In xh '循环每个学号
Dim drs As List(of DataRow) = DataTables("0000").Select("学号 = '" & xm & "'") '查询和这个学号有关的记录
Dim dr As DataRow = DataTables("1111").AddNew()
Dim r As DataRow = drs(0)
dr("学号") = xm
dr("姓名") = r("姓名")
dr("班级") = r("班级")
For Each r As DataRow In drs
dr(r("学科") & "老师") = r("教师名字") '增加学科的来是名字
Next
Next