以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- 如何一起复制关联表 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=101060) |
||||
-- 作者:binabc2004 -- 发布时间:2017/5/24 13:10:00 -- 如何一起复制关联表 大家好! 我做了一个订单关联表,一个订单表下面关联了四个表格,请问我想只改订单编号,其它四个表格一起复印内容。请问我要如何编写才对。谢谢大家帮忙!
|
||||
-- 作者:y2287958 -- 发布时间:2017/5/24 14:15:00 -- “一起复印内容”啥意思?没看懂 |
||||
-- 作者:有点色 -- 发布时间:2017/5/24 14:37:00 -- Dim ddbh As String = e.Form.controls("Textbox1").Text Dim bh As String = e.Form.controls("textbox2").Text Dim ts() As String = {"成衣部位表","加工费用表","车工费用表","辅料表","订单表"} For Each t As String In ts For Each dr1 As DataRow In DataTables(t).Select("订单编号=\'" & ddbh & "\'") Dim dr2 As DataRow = DataTables(t).AddNew() For Each dc As DataCol In DataTables(t).DataCols If dc.name = "订单编号" Then dr2("订单编号") = bh Else dr2(dc.Name) = dr1(dc.name) End If Next Next Next |
||||
-- 作者:binabc2004 -- 发布时间:2017/5/24 14:52:00 -- 谢谢,版主帮忙,可以啦 |
||||
-- 作者:binabc2004 -- 发布时间:2017/5/26 10:27:00 -- 版主我发现可以复制相同订单编号,如果不想可以复制相同订单编号应该如何加入条件。 |
||||
-- 作者:有点蓝 -- 发布时间:2017/5/26 12:03:00 -- Dim ddbh As String = e.Form.controls("Textbox1").Text Dim bh As String = e.Form.controls("textbox2").Text If DataTables("订单表").Find("订单编号=\'" & bh & "\'") IsNot Nothing Then msgbox("已存在此订单号" & bh) Return End If Dim ts() As String = {"成衣部位表","加工费用表","车工费用表","辅料表","订单表"} For Each t As String In ts For Each dr1 As DataRow In DataTables(t).Select("订单编号=\'" & ddbh & "\'") Dim dr2 As DataRow = DataTables(t).AddNew() For Each dc As DataCol In DataTables(t).DataCols If dc.name = "订单编号" Then dr2("订单编号") = bh Else dr2(dc.Name) = dr1(dc.name) End If Next Next Next
|