以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  关联表克隆  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=109084)

--  作者:yifan3429
--  发布时间:2017/11/3 18:26:00
--  关联表克隆
订单 订单明细 明细构件  三个表格  通过编号关联  如何一次克隆
--  作者:cd_tdh
--  发布时间:2017/11/3 18:30:00
--  
用两个表引用另外一个表的数据。
--  作者:有点甜
--  发布时间:2017/11/3 18:36:00
--  

Dim t1 As Table
Dim t2 As Table
Dim t3 As Table
For Each r1 As DataRow In t1.DataTable.Select("bh = \'" & t1.current("bh") & "\'")
    Dim nr1 As Row = t1.addnew
    For Each c As Col In t1.cols
        nr1(c) = r1(c.name)
    Next
    For Each r2 As DataRow In t2.DataTable.Select("bh = \'" & r1("bh") & "\'")
        Dim nr2 As Row = t2.addnew
        For Each c As Col In t1.cols
            nr2(c) = r2(c.name)
        Next
        For Each r3 As DataRow In t3.DataTable.Select("bh = \'" & r2("bh") & "\'")
            Dim nr3 As Row = t3.addnew
            For Each c As Col In t3.cols
                nr3(c) = r3(c.name)
            Next
        Next
    Next
Next