以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]表A从表B里面提取值怎么写  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=83633)

--  作者:大红袍
--  发布时间:2016/4/13 16:32:00
--  

If e.DataCol.Name = "第二列" Then
    Dim fdr As DataRow = DataTables("表b").Find("第二列 = \'" & e.DataRow("第二列") & "\'")
    If fdr IsNot Nothing Then
        e.DataRow("第一列") = fdr("第一列")
    Else
        e.DataRow("第一列") = Nothing
    End If
End If


--  作者:大红袍
--  发布时间:2016/4/14 10:04:00
--  
For Each dr As DataRow In DataTables("表A").Select("")
    Dim fdr As DataRow = DataTables("表b").Find("第二列 = \'" & dr("第二列") & "\'")
    If fdr IsNot Nothing Then
        dr("第一列") = fdr("第一列")
    Else
        dr("第一列") = Nothing
    End If
next

--  作者:大红袍
--  发布时间:2016/4/14 10:12:00
--  

看4楼

 

For Each dr As DataRow In DataTables("表B").Select("")
    DataTables("表A").ReplaceFor("第一列", dr("第一列"), "第二列 = \'" & dr("第二列") & "\'")
Next