Foxtable(狐表)用户栏目专家坐堂 → 将一表内相同姓名的同学用期中减月一


  共有2856人关注过本帖树形打印复制链接

主题:将一表内相同姓名的同学用期中减月一

帅哥哟,离线,有人找我吗?
y2287958
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:狐神 帖子:4752 积分:34568 威望:0 精华:0 注册:2008/8/31 22:44:00
  发帖心情 Post By:2018/11/17 23:16:00 [显示全部帖子]

要设置列标志

 回到顶部
帅哥哟,离线,有人找我吗?
y2287958
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:狐神 帖子:4752 积分:34568 威望:0 精华:0 注册:2008/8/31 22:44:00
  发帖心情 Post By:2018/11/18 0:49:00 [显示全部帖子]

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编辑过]

 回到顶部