以文本方式查看主题

-  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=99814)

--  作者:cd_tdh
--  发布时间:2017/4/27 11:08:00
--  遍历表把符合要求的行添加到快递查询表中
大师,有个快递查询表,刷新按钮能把所有表中符合要求的添加到快递查询表中,通过三列:快递名称、快递单号、寄件信息,重复的快递单号不添加。
 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:管理项目1.foxdb


--  作者:有点色
--  发布时间:2017/4/27 11:33:00
--  
Dim tns() As String = {"表A", "表B", "表C"}
Dim dt As DataTable = DataTables("快递查询表")
For Each tn As String In tns
    For Each r As Row In Tables(tn).Rows
        If r.IsNull("快递单号") = False Then
            Dim fdr As DataRow = dt.Find("快递单号 = \'" & r("快递单号") & "\'")
            If fdr Is Nothing Then
                Dim nr As DataRow = dt.AddNew
                nr("快递名称") = r("快递名称")
                nr("快递单号") = r("快递单号")
                nr("寄件日期") = r("寄件日期")
            End If
        End If
    Next
Next

--  作者:cd_tdh
--  发布时间:2017/4/27 12:02:00
--  

不用表名,怎么实现遍历项目中所有表。


--  作者:有点色
--  发布时间:2017/4/27 12:06:00
--  

Dim dt As DataTable = DataTables("快递查询表")
For Each t As DataTable In DataTables
    If t.name <> dt.name AndAlso t.DataCols.Contains("快递单号") Then
        For Each r As DataRow In t.dataRows
            If r.IsNull("快递单号") = False Then
                Dim fdr As DataRow = dt.Find("快递单号 = \'" & r("快递单号") & "\'")
                If fdr Is Nothing Then
                    Dim nr As DataRow = dt.AddNew
                    nr("快递名称") = r("快递名称")
                    nr("快递单号") = r("快递单号")
                    nr("寄件日期") = r("寄件日期")
                End If
            End If
        Next
    End If
Next

--  作者:cd_tdh
--  发布时间:2017/4/30 13:31:00
--  
色大师,查询表里面,可否通过点快递单号就直接定位到原来的表里面相应的位置呢?
--  作者:有点蓝
--  发布时间:2017/5/2 8:33:00
--  
参考:http://www.foxtable.com/webhelp/scr/0552.htm