以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 关联表复制到另一个关联表报错 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=172723) |
-- 作者:lgz518 -- 发布时间:2021/10/28 0:01:00 -- 关联表复制到另一个关联表报错 需求:A主表,A明细是关联表,批量复制B主表和B明细是关联表, 在窗口上-按键-执行下代码, 1.不执行红字代码,是可以分表复制,但B主表和B明细是关联表,B明细关联表无数据,B明细无关联表有数据? 2,执行红字代码,执行不了 Dim Cols1() As String = {"订货日期","客户名称"} Dim Cols2() As String = {"日期","客户"} For Each dr1 As DataRow In DataTables("A主表").Select("[选中] = 1 ") Dim dr2 As DataRow = DataTables("B主表").AddNew() For i As Integer = 0 To Cols1.Length -1 dr2(Cols2(i)) = dr1(Cols1(i)) Next Next Dim Cols3() As String = {"产品编号","产品名称","数量","单位"} Dim Cols4() As String = {"存货编码","存货名称","数量","单位"} For Each dr3 As DataRow In DataTables("A明细").Select("[选中] = 1 ") Dim dr4 As DataRow = DataTables("B明细").AddNew() \'Dim dr4 As DataRow = DataTables("B主表.B明细").AddNew() For r As Integer = 0 To Cols3.Length -1 dr4(Cols4(r)) = dr3(Cols3(r)) Next Next |
-- 作者:有点蓝 -- 发布时间:2021/10/28 8:47:00 -- For Each dr3 As DataRow In DataTables("A明细").Select("[选中] = 1 ") Dim dr4 As Row = Tables("B主表.B明细").AddNew() For r As Integer = 0 To Cols3.Length -1 dr4(Cols4(r)) = dr3(Cols3(r)) Next Next
|