以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助] filter 问题  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=127038)

--  作者:sanny
--  发布时间:2018/11/3 15:51:00
--  [求助] filter 问题

请指都我要在下面的代码中增加以下功能:


[此贴子已经被作者于2019/10/7 10:49:44编辑过]

--  作者:有点蓝
--  发布时间:2018/11/3 16:28:00
--  
fill填充无法去重,这种方式复制数据才可以:http://www.foxtable.com/webhelp/scr/1533.htm

Dim Cols1() As String = {"GSSAG_PO","Customer"}
Dim d As Date = Forms("Mainfrm").Controls("startdate").value
For Each dr1 As DataRow In DataTables("Orderlist").Select("[Orderdate] = #" & d & "#")
    Dim dr2 As DataRow = DataTables("Packinglist").Find("GSSAG_PO=\'" & dr1("GSSAG_PO") & "\' and Customer=\'" & dr1("Customer") & "\'")
    If dr2 IsNot Nothing Then
        Dim Result As DialogResult
        Result = MessageBox.Show("重复,是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
        If Result = DialogResult.Yes Then
            For i As Integer = 0 To Cols1.Length -1
                dr2(Cols2(i)) = dr1(Cols1(i))
            Next
            dr2("Orderdate") = d
        End If
    End If
Next

--  作者:sanny
--  发布时间:2018/11/3 19:03:00
--  

谢谢。 不过出现了错误 ,显示: 编译错误,未声明名称 “Cols2", 错误代码 dr2(Cols2(i)) = dr1(Cols1(i))


--  作者:sanny
--  发布时间:2018/11/4 10:40:00
--  
请帮忙看一下哪儿错了。谢谢。
--  作者:y2287958
--  发布时间:2018/11/4 13:54:00
--  
Dim Cols1() As String = {"GSSAG_PO","Customer"}
Dim d As Date = Forms("Mainfrm").Controls("startdate").value
If d <> Nothing
    For Each dr1 As DataRow In DataTables("Orderlist").Select("[Orderdate] = #" & d & "#")
        Dim dr2 As DataRow = DataTables("Packinglist").Find("GSSAG_PO=\'" & dr1("GSSAG_PO") & "\' and Customer=\'" & dr1("Customer") & "\'")
        If dr2 IsNot Nothing Then
            Dim Result As DialogResult
            Result = MessageBox.Show("重复,是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
            If Result = DialogResult.Yes Then
                For i As Integer = 0 To Cols1.Length -1
                    dr2(Cols1(i)) = dr1(Cols1(i))
                Next
                dr2("Orderdate") = d
            End If
        End If
    Next
End If