Foxtable(狐表)用户栏目专家坐堂 → [求助]从水平表到垂直表


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

主题:[求助]从水平表到垂直表

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


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

Dim t As Table = Tables("表A")
For i As Integer = t.TopPosition To t.BottomPosition
    Dim dr1 As Row = t.Rows(i)
    Dim dr2 As DataRow = DataTables("表B").Find("编码 = '" & dr1("编码") & "' and 品名 = '" & dr1("品名") & "' and 规格 = '" & dr1("规格")  & "' and 备注 = '" & dr1("备注")  & "'")
    If dr2 IsNot Nothing Then
        For Each c As Col In Tables("表b").Cols
            If c.name.StartsWith("NO") Then
                Dim nr As Row = Tables("表D").addnew
                nr("编码") = dr2("编码")
                nr("品名") = dr2("品名")
                nr("规格") = dr2("规格")
                nr("备注") = dr2("备注")
                nr("nox") = c.name
                nr("no") = dr2(c.name)
            End If
        Next
    End If
Next


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


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

Dim t As Table = Tables("表A")
For i As Integer = t.TopPosition To t.BottomPosition
    Dim dr1 As Row = t.Rows(i)
    Dim dr2 As DataRow = DataTables("表B").Find("编码 = '" & dr1("编码") & "' and 品名 = '" & dr1("品名") & "' and 规格 = '" & dr1("规格")  & "' and 备注 = '" & dr1("备注")  & "'")
    If dr2 IsNot Nothing Then
        For Each c As Col In Tables("表b").Cols
            If c.name.StartsWith("NO") AndAlso dr2.IsNull(c.name) = False Then
                Dim nr As DataRow = DataTables("表D").find("编码 = '" & dr1("编码") & "' and 品名 = '" & dr1("品名") & "' and 规格 = '" & dr1("规格")  & "' and 备注 = '" & dr1("备注")  & "' and nox = '" & c.name & "'")
                If nr Is Nothing Then nr = DataTables("表D").addnew               
                nr("编码") = dr2("编码")
                nr("品名") = dr2("品名")
                nr("规格") = dr2("规格")
                nr("备注") = dr2("备注")
                nr("nox") = c.name
                nr("no") = dr2(c.name)
            End  If
        Next
    End If
Next

 回到顶部