以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  求助! 用代码执行自动复制行的问题  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=44171)

--  作者:飞天
--  发布时间:2013/12/24 17:26:00
--  求助! 用代码执行自动复制行的问题
        If e.DataRow("节点") = 1 Then
            Dim nma() As String = {"客户编号"} \'A表数据来源列
            Dim nmb() As String = {"客户编号"} \'B表数据接收列
            Dim dr As DataRow = DataTables("报价单").AddNew
            For i As Integer = 0 To nma.Length - 1
                dr(nmb(i)) = e.DataRow(nma(i))
            Next
         End if

以上代码是自动复制行,希望加上一个条件 " 当表B有相同的客户编码时,则路过.

--  作者:Bin
--  发布时间:2013/12/24 17:31:00
--  
 If e.DataRow("节点") = 1 Then
            Dim nma() As String = {"客户编号"} \'A表数据来源列
            Dim nmb() As String = {"客户编号"} \'B表数据接收列
            Dim dr As DataRow = DataTables("报价单").find("客户编号=\'" & e.datarow("客户编号") & "\'")
            if dr is nothing then
            dr = DataTables("报价单").AddNew
            For i As Integer = 0 To nma.Length - 1
                dr(nmb(i)) = e.DataRow(nma(i))
            Next
            end if
         End if

--  作者:weigqing9
--  发布时间:2014/7/14 19:36:00
--  
学习了,真强大