Foxtable(狐表)用户栏目专家坐堂 → 组合请教


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

主题:组合请教

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


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

Dim arys() As String = {"1", "2", "3", "4"}

For i As Integer = 0 To arys.Length - 2
    For j As Integer = i+1 To arys.Length - 1
        output.show(arys(i) & "," & arys(j))
    Next
Next


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


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

Dim ls As List(Of String) = DataTables("表A").GetValues("单位", "单位 is not null")

For i As Integer = 0 To ls.Count - 2
    For j As Integer = i+1 To ls.Count - 1
        Dim ndr As DataRow = DataTables("表B").AddNew
        ndr("单位组合") = ls(i) & "-" & ls(j)
    Next
Next


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


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

Dim ls As List(Of String) = DataTables("表A").GetValues("单位", "单位 is not null")

For i As Integer = 0 To ls.Count - 2
    For j As Integer = i+1 To ls.Count - 1
        Dim ndr As DataRow = DataTables("表B").AddNew
        ndr("单位组合") = ls(i) & "-" & ls(j)
        Dim dr1 As DataRow = DataTables("表A").Find("单位 = '" & ls(i) & "' and 对象 = '" & ls(j) & "'")
        Dim dr2 As DataRow = DataTables("表A").Find("单位 = '" & ls(j) & "' and 对象 = '" & ls(i) & "'")
        ndr("性质1") = dr1("性质")
        ndr("性质1金额") = dr1("金额")
        ndr("性质2") = dr2("性质")
        ndr("性质2金额") = dr2("金额")
    Next
Next


 回到顶部