Dim ss As List(of String) = DataTables("data").GetValues("学号")
Dim lst As new List(of String)
For Each s As String In ss
Dim dr1 As DataRow = DataTables("data").Find("学号='" & s & "'","考次 desc")
Dim dr2 As DataRow = DataTables("data").Find("学号='" & s & "'","考次 desc",1)
Dim ds As String = dr1("班级") & "," & dr1("学号") & "," & dr1("姓名") & ",比较"
For Each dc As DataCol In DataTables("data").DataCols
If dc.Name<>"班级" AndAlso dc.Name<>"学号" AndAlso dc.Name<>"姓名" AndAlso dc.Name<>"考次"
If dr1 IsNot Nothing AndAlso dr2 IsNot Nothing
ds += "," & (dr2(dc.Name) - dr1(dc.Name))
Else
ds += "," & dr1(dc.Name)
End If
End If
Next
lst.Add(ds)
Next
For Each ls As String In lst
Dim dr As DataRow = DataTables("data").AddNew
For i As Integer = 0 To DataTables("data").DataCols.Count-1
dr(Tables("data").Cols(i).Name) = ls.Split(",")(i)
Next
Next
Tables("data").sort = "班级,学号,姓名,考次 desc"
[此贴子已经被作者于2018/11/18 0:49:03编辑过]