老师,你好,循环调用时,数据出现了错位,不知道代码哪里出了问题?是不是循环的原因?
此主题相关图片如下:qq图片20180628200853.png
我想让统计的数据出现在同一行,需要的效果是:
此主题相关图片如下:qq图片20180628201100.png
代码如下
Dim tp As Table = Tables("查询科目")
For ii As Integer = 0 To tp.Rows.Count -1
Dim t As Table = Tables("优秀学生")
t.StopRedraw
Dim r As Row
Dim max As Integer = Tables("班级成绩").Rows.Count - 1
If max > 13 Then max = 13
For i As Integer = 0 To max
Tables("班级成绩").Sort = tp.Rows(ii)("学科") & " desc"
r = t.AddNew
r(tp.Rows(ii)("学科") & "_班排") = Tables("班级成绩").Rows(i)(tp.Rows(ii)("学科") & "班排")
r(tp.Rows(ii)("学科") & "_排名") = Tables("班级成绩").Rows(i)(tp.Rows(ii)("学科") & "排名")
r(tp.Rows(ii)("学科") & "_姓名") = Tables("班级成绩").Rows(i)("姓名")
r(tp.Rows(ii)("学科") & "_分数") = Tables("班级成绩").Rows(i)(tp.Rows(ii)("学科"))
Tables("班级成绩").Sort = "总分" & " desc"
r("总分_班排") = Tables("班级成绩").Rows(i)("总分班排")
r("总分_排名") = Tables("班级成绩").Rows(i)("总分排名")
r("总分_姓名") = Tables("班级成绩").Rows(i)("姓名")
r("总分_分数") = Tables("班级成绩").Rows(i)("总分")
Next
t.ResumeRedraw
Next