Foxtable(狐表)用户栏目专家坐堂 → [求助]同步两个表的数据


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

主题:[求助]同步两个表的数据

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


加好友 发短信
等级:超级版主 帖子:13837 积分:69650 威望:0 精华:0 注册:2016/11/1 14:42:00
  发帖心情 Post By:2016/11/1 18:57:00 [显示全部帖子]

Dim sCols() As String =  {"xingming","xingbie","sfzhm","minzu","year","beizhu"}
Dim dCols() As String =  {"xingming","xingbie","sfzhm","minzu","year","beizhu"}


Dim dt = DataTables("A表")


For Each dr As DataRow In dt.DataRows
    Dim drs As List(Of DataRow) = DataTables("B表").Select("sfzhm= '" & dr("sfzhm") & "'")
    If drs.count = 0 Then
        Dim nr As DataRow = DataTables("xszzbb").AddNew()
        For i As Integer =0 To sCols.Length -1
            nr(dCols(i)) = dr(sCols(i))
        Next
    Else
        For Each nr As DataRow In drs
            For i As Integer =0 To sCols.Length -1
                nr(dCols(i)) = dr(sCols(i))
            Next
        Next 
    End If
Next


 回到顶部