有没有学号呀?
Dim dtb As New DataTableBuilder("表B")
dtb.AddDef("班级",Gettype(String),10)
dtb.AddDef("学号",Gettype(String),12)
dtb.AddDef("姓名",Gettype(String),20)
For Each v As String In DataTables("表A").GetValues("课程")
dtb.AddDef(v, Gettype(Double))
Next
dtb.Build()
For Each v As String() In DataTables("表A").GetValues("班级|学号|姓名")
Dim dr1 As DataRow = DataTables("表B").AddNew()
dr1("班级") = v(0)
dr1("学号") = v(1)
dr1("姓名") = v(2)
For Each dr2 As DataRow In DataTables ("表A").Select("班级= '" & v(0) & "' And 学号='" & V(1) & "' And 姓名= '" & v(2) & "'")
dr1(dr2("课程")) = dr2("分数")
Next
Next
MainTable = Tables("表B")