以文本方式查看主题

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

--  作者:好吧
--  发布时间:2016/11/25 21:46:00
--  【求助】跨表引用
各位老师,请问怎样可以将外部数据表中多列的内容引用到foxtable表的某一列中,或者是将多张外部数据表中多列的内容引用到foxtable表的某一列,希望各位老师赐教,谢谢啦
--  作者:有点蓝
--  发布时间:2016/11/26 8:46:00
--  
参考:http://www.foxtable.com/webhelp/scr/1451.htm
--  作者:好吧
--  发布时间:2016/11/26 10:10:00
--  
有点蓝老师,这是我写的代码,蓝色代码得到的值会把橙色代码得到的值覆盖掉,我想两个值同时存在,该怎么改??请老师赐教,谢谢

If e.DataCol.Name = "姓名" Then
    If e.NewValue Is Nothing Then
        e.DataRow("性别") = Nothing
        e.DataRow("年龄") = Nothing
        e.DataRow("毕业学校") = Nothing
    Else
        Dim dr As DataRow
        Dim dr2 As DataRow
        dr = DataTables("表B").Find("[姓名] = \'" & e.NewValue & "\'")
        dr2 = DataTables("表C").Find("[姓名] = \'" & e.NewValue & "\'")
        If dr IsNot Nothing 
            e.DataRow("性别") = dr("性别")
            e.DataRow("毕业学校") = dr("学历")
        End If
        If dr2 IsNot Nothing 
            e.DataRow("年龄") = dr2("年龄")
            e.DataRow("毕业学校") = dr2("学校")
        End If
    End If
End If

--  作者:有点蓝
--  发布时间:2016/11/26 10:28:00
--  
If dr IsNot Nothing
    e.DataRow("性别") = dr("性别")
    e.DataRow("毕业学校") = dr("学历")
End If
If dr2 IsNot Nothing
    e.DataRow("年龄") = dr2("年龄")
    If e.DataRow.Isnull("毕业学校")
        e.DataRow("毕业学校") = dr2("学校")
    Else
        e.DataRow("毕业学校") = e.DataRow("毕业学校") & "," & dr2("学校")
    End If
End If

--  作者:好吧
--  发布时间:2016/11/26 11:00:00
--  
多谢有点蓝老师