Foxtable(狐表)用户栏目专家坐堂 → 如何实现B表如何从A表获取到B表不存在的记录


  共有1775人关注过本帖树形打印复制链接

主题:如何实现B表如何从A表获取到B表不存在的记录

帅哥哟,离线,有人找我吗?
有点甜
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2017/11/15 17:11:00 [显示全部帖子]

Dim dt As DataTable = DataTables("表A")
For Each dr As DataRow In dt.DataRows
    If DataTables("表B").Find("第一列 = '" & dr("第一列") & "'") Is Nothing Then
        Dim nr As DataRow = DataTables("表B").AddNew()
        For Each dc As DataCol In dt.DataCols
            nr(dc.name) = dr(dc.name)
        Next
    End If
Next

 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2017/11/15 17:39:00 [显示全部帖子]

Dim dt As DataTable = DataTables("表A")
Dim dt2 As DataTable = DataTables("表B")
For Each dr As DataRow In dt.DataRows
    If dt2.Find("第一列 = '" & dr("第一列") & "'") Is Nothing Then
        Dim nr As DataRow = dt2.AddNew()
        For Each dc As DataCol In dt.DataCols
            If dt2.datacols.contains(dc.name) Then
                nr(dc.name) = dr(dc.name)
            End If
        Next
    End If
Next

 回到顶部