Foxtable(狐表)用户栏目专家坐堂 → 竖表转水平表代码有问题


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

主题:竖表转水平表代码有问题

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/7/31 9:09:00 [显示全部帖子]

Dim tb3 As Table = Tables("标录分析_Table3")

Dim tb4 As Table = Tables("标录分析_Table4")

Dim dtb As New DataTableBuilder("表B")

dtb.AddDef("年", Gettype(String), 32)

dtb.AddDef("月", Gettype(String), 32)

For Each nm As String In tb3.DataTable.GetValues("随机摸球法_中标球号")

    dtb.AddDef(nm, Gettype(Double))

Next

tb4.DataSource = dtb.BuildDataSource
For Each nm As String() In tb3.DataTable.GetValues("年|月")

    Dim dr1 As Row = tb4.AddNew()

    dr1("年") = nm(0)

    dr1("月") = nm(1)

    For Each dr2 As DataRow In tb3.DataTable.Select("年 = '" & nm(0) & "' And 月 = '" & nm(1) & "'")

        dr1(dr2("随机摸球法_中标球号")) = dr2("记录数")

    Next

Next


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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/7/31 13:10:00 [显示全部帖子]

Dim tb1 As Table = Tables("标录分析_Table1")
Dim tb2 As Table = Tables("标录分析_Table2")
Dim dtb As New DataTableBuilder("水平表")
dtb.AddDef("年", Gettype(String), 32)
dtb.AddDef("月", Gettype(String), 32)
For Each nm As String In tb1.DataTable.GetValues("中标球号")
    dtb.AddDef("c" & nm, Gettype(Double), "", nm)
Next
tb2.DataSource = dtb.BuildDataSource
For Each nm As String() In tb1.DataTable.GetValues("年|月")
    Dim dr1 As Row = tb2.AddNew()
    dr1("年") = nm(0)
    dr1("月") = nm(1)
    For Each dr2 As DataRow In tb1.DataTable.Select("年 = '" & nm(0) & "' And 月 = '" & nm(1) & "'")
        dr1("c" & dr2("中标球号")) = dr2("记录数")
    Next
Next

 回到顶部