以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  跨数据库查找  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=160442)

--  作者:lfz123
--  发布时间:2021/2/2 17:21:00
--  跨数据库查找
怎样可以在别的数据库查找数据,比如我有2020帐套.MDB和2021帐套.MDB 数据库,表的结构是完全一样
If e.DataCol.name = "销方名称" Then
    If  e.DataRow.IsNull("销方名称") Then
        e.DataRow("发票摘要") = Nothing
        e.DataRow("借方代码") = Nothing
    Else
        Dim dr As DataRow = e.DataTable.SQLFind("销方名称 = \'" & e.DataRow("销方名称") & "\'","开票日期 DESC")
        If dr IsNot Nothing Then
            e.DataRow("发票摘要") = dr("发票摘要")
            e.DataRow("借方代码") = dr("借方代码")
        End If
    End If
End If

--  作者:有点蓝
--  发布时间:2021/2/2 17:27:00
--  
添加到数据源里,把这个表加载进来

Dim dr As DataRow = DataTables(“B数据源某表”).SQLFind("销方名称 = \'" & e.DataRow("销方名称") & "\'","开piao日期 DESC")