以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  [求助]已经复制的行不再复制一次  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=86728)

--  作者:liu1992
--  发布时间:2016/6/24 9:53:00
--  [求助]已经复制的行不再复制一次

以下是我写的复制行的代码,想请问如何实现已经复制过的行不再复制一次到表B中。

If e.DataCol.Name = "是否销售给航信" AndAlso e.DataRow("是否销售给航信") = True Then
    Dim Result As DialogResult
    Result = MessageBox.Show("销售客户确认为航信?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
    If Result = DialogResult.NO Then
        MessageBox.Show("销售客户不是航信.","提示")
        e.Cancel = True \'取消编辑
        e.DataRow("是否销售给航信") = False
    End If
    If Result = DialogResult.YES Then
        Dim nma() As String = {"品种","中文品名","荒料编号","测算表号","采购成本含税","现存仓库","销售日期","航信销售日期","航信销售总额","航信销售客户"} \'"JKH荒料"表数据来源列
        Dim  nmb()  As  String = {"品种","品名","荒料编号","测算表号","采购成本","仓库","入库日期","航信销售日期","航信销售总额","航信销售客户"}  \'"航信台账"表数据接收列
        Dim  dr  As DataRow = DataTables("航信台账").AddNew
        For i As Integer = 0 To nma.Length - 1
            dr(nmb(i)) = e.DataRow(nma(i))
        Next
        MessageBox.Show("本条销售记录已经带入【航信台账】", "提示")
    End If
End If

[此贴子已经被作者于2016/6/24 9:53:17编辑过]

--  作者:大红袍
--  发布时间:2016/6/24 9:59:00
--  
If e.DataCol.Name = "是否销售给航信" AndAlso e.DataRow("是否销售给航信") = True Then
    Dim Result As DialogResult
    Result = MessageBox.Show("销售客户确认为航信?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
    If Result = DialogResult.NO Then
        MessageBox.Show("销售客户不是航信.","提示")
        e.Cancel = True \'取消编辑
        e.DataRow("是否销售给航信") = False
    End If
    If Result = DialogResult.YES Then
        Dim fdr As DataRow = DataTables("航信台账").Find("来自id = \'" & e.DataRow("_Identify") & "\'")
        If fdr Is Nothing Then
            fdr = DataTables("航信台账").AddNew
        End If

        Dim nma() As String = {"品种","中文品名","荒料编号","测算表号","采购成本含税","现存仓库","销售日期","航信销售日期","航信销售总额","航信销售客户"} \'"JKH荒料"表数据来源列
        Dim  nmb()  As  String = {"品种","品名","荒料编号","测算表号","采购成本","仓库","入库日期","航信销售日期","航信销售总额","航信销售客户"}  \'"航信台账"表数据接收列
        For i As Integer = 0 To nma.Length - 1
            fdr(nmb(i)) = e.DataRow(nma(i))
        Next
        fdr("来自id") = e.DataRow("_Identify")
        MessageBox.Show("本条销售记录已经带入【航信台账】", "提示")
    End If
End If