Foxtable(狐表)用户栏目专家坐堂 → 按条件引用代码


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

主题:按条件引用代码

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


加好友 发短信
等级:狐神 帖子:4650 积分:33912 威望:0 精华:0 注册:2008/8/31 22:44:00
  发帖心情 Post By:2021/7/8 8:23:00 [显示全部帖子]

Dim lst As new List(of String)
For Each dr As DataRow In DataTables("表A").Select("编码 is not null and 编码 <> ''")
    Dim fdr As DataRow = DataTables("表B").find("编码='" & dr("编码") & "'")
    If fdr IsNot Nothing Then
        For Each dc As DataCol In DataTables("表A").DataCols
            If DataTables("表B").DataCols.Contains(dc.name) AndAlso dc.name <> "序号"
                dr(dc.name) = fdr(dc.name)
            End If
        Next
    Else
        lst.add(dr("编码"))
    End If
Next
If lst.Count > 0
    Dim s As String = String.join(vbcrlf,lst.ToArray)
    MessageBox.Show(s)
End If


 回到顶部