以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  怎么做到跨表定位引用数据  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=132747)

--  作者:yfy13338431925
--  发布时间:2019/3/28 21:12:00
--  怎么做到跨表定位引用数据

甜老师,蓝老师:

如果把表A【第一列】第三行未知的数据引用到表B【第三列】第五行的位置怎么做?如果引用后的数据前面再加一个前缀"XXX-"呢?

在下面的代码中该怎样改?

 

Dim Cols1() As String = {"第一列"}
Dim Cols2() As String = {"第三列"}
Dim dr1 As Row = Tables("表A").current
Dim dr2 As DataRow = DataTables("表B").AddNew()
For i As Integer = 0 To Cols1.Length -1
    dr2(Cols2(i)) = dr1(Cols1(i))
Next


--  作者:有点甜
--  发布时间:2019/3/28 21:39:00
--  
Dim Cols1() As String = {"第一列"}
Dim Cols2() As String = {"第三列"}
Dim dr1 As Row = Tables("表A").Rows(2)
Dim dr2 As Row = Tables("表B").rows(4)
For i As Integer = 0 To Cols1.Length -1
    dr2(Cols2(i)) = dr1(Cols1(i))
Next

--  作者:yfy13338431925
--  发布时间:2019/3/28 22:37:00
--  
如果引用后的数据前面再加一个前缀"XXX-"呢?
--  作者:有点甜
--  发布时间:2019/3/28 23:09:00
--  
Dim Cols1() As String = {"第一列"}
Dim Cols2() As String = {"第三列"}
Dim dr1 As Row = Tables("表A").Rows(2)
Dim dr2 As Row = Tables("表B").rows(4)
For i As Integer = 0 To Cols1.Length -1
    dr2(Cols2(i)) = "XXX-" & dr1(Cols1(i))
Next

--  作者:yfy13338431925
--  发布时间:2019/3/28 23:13:00
--  

甜老师:麻烦您了

如果两张表是关联表,第一列关联,红色部分怎样改?

Dim Cols1() As String = {"第二列"}
Dim Cols2() As String = {"第三列"}
Dim dr1 As Row = Tables("表A").Rows(2)
Dim dr2 As Row =  Tables("表A.表B").rows(4)

For i As Integer = 0 To Cols1.Length -1
    dr2(Cols2(i)) = dr1(Cols1(i))
Next


--  作者:有点甜
--  发布时间:2019/3/28 23:22:00
--  
Dim dr1 As Row = Tables("表A").current