以文本方式查看主题
- Foxtable(狐表) (http://www.foxtable.com/bbs/index.asp)
-- 专家坐堂 (http://www.foxtable.com/bbs/list.asp?boardid=2)
---- 高难度,从表A提取数据到表C中?? (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=115389)
|
-- 作者:top123
-- 发布时间:2018/3/6 15:47:00
-- 高难度,从表A提取数据到表C中??
此主题相关图片如下:1520322159(1)_副本.png
此主题相关图片如下:1520322177(1)_副本.png
从表A提取数据到表C中??
|
-- 作者:有点甜
-- 发布时间:2018/3/6 16:01:00
--
Dim Cols1() As String = {"第一列","第三列","第四列"} Dim Cols2() As String = {"第一列","第四列","第五列"} For Each dr1 As DataRow In DataTables("表A").Select("第一列 is not null") Dim dr2 As DataRow = DataTables("表B").AddNew() For i As Integer = 0 To Cols1.Length -1 dr2(Cols2(i)) = dr1(Cols1(i)) Next Dim str = dr1("第二列") Dim ary() = str.replace(chr(10),"").split(chr(13)) dr2("第二列") = ary(0).split(":")(1) dr2("第三列") = ary(1).split(":")(1) dr2("第四列") = ary(2).split(":")(1) Next
|
-- 作者:top123
-- 发布时间:2018/3/6 16:58:00
--
Dim Cols1() As String = {"第一列","第三列","第四列"} Dim Cols2() As String = {"第一列","第四列","第五列"} For Each dr1 As DataRow In DataTables("表A").Select("第一列 is not null") Dim dr2 As DataRow = DataTables("表B").AddNew() For i As Integer = 0 To Cols1.Length -1 dr2(Cols2(i)) = dr1(Cols1(i)) Next Dim str = dr1("第二列") Dim ary() = str.replace(chr(10),"").split(chr(13)) dr2("第二列") = ary(0).split(":")(1) dr2("第三列") = ary(1).split(":")(1) dr2("第四列") = ary(2).split(":")(1) Next
|
已经可以实现了
只是再运行一遍时,还是会把之前运行过的再重新重复提取,这个如何改掉
|
-- 作者:有点甜
-- 发布时间:2018/3/6 17:27:00
--
Dim Cols1() As String = {"第一列","第三列","第四列","_Identify"} Dim Cols2() As String = {"第一列","第四列","第五列", "第十列"} For Each dr1 As DataRow In DataTables("表A").Select("第一列 is not null") Dim dr2 As DataRow = DataTables("表B").find("第十列 = \'" & dr1("_Identify") & "\'") If dr2 Is Nothing dr2 = DataTables("表B").AddNew() End If For i As Integer = 0 To Cols1.Length -1 dr2(Cols2(i)) = dr1(Cols1(i)) Next Dim str = dr1("第二列") Dim ary() = str.replace(chr(10),"").split(chr(13)) dr2("第二列") = ary(0).split(":")(1) dr2("第三列") = ary(1).split(":")(1) dr2("第四列") = ary(2).split(":")(1) Next
|