以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 如何用代码实现把交叉统计的临时表的内容复制到正式表中? (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=191048) |
-- 作者:jiawei507 -- 发布时间:2024/3/23 14:46:00 -- 如何用代码实现把交叉统计的临时表的内容复制到正式表中? 如何用代码实现把交叉统计的临时表的内容复制到正式表中?尝试好久,整不明白,能帮忙写下吗? Dim Cols1() As String = { "项目归属", "项目编号", "开票"} Dim Cols2() As String = { "项目归属", "项目编号", "开票"} Each dr1 As DataRow In DataTables("统计表1").DataRows DataTables("产值统计表").DataRows.Clear Dim dr2 As DataRow = DataTables("产值统计表").AddNew() For i As Integer = 0 To Cols1.Length - 1 dr2(Cols2(i)) = dr1(Cols1(i)) Next 谢谢了
|
-- 作者:有点蓝 -- 发布时间:2024/3/23 15:10:00 -- DataTables("产值统计表").DataRows.Clear For Each dr1 As DataRow In DataTables("统计表1").DataRows Dim dr2 As DataRow = DataTables("产值统计表").AddNew() For Each dc As DataCol In DataTables("统计表1").datacols If DataTables("产值统计表").datacols.contains(dc.caption) Then dr2(dc.caption) = dr1(dc.name) ElseIf DataTables("产值统计表").datacols.contains(dc.name) Then dr2(dc.name) = dr1(dc.name) End if Next Next |
-- 作者:jiawei507 -- 发布时间:2024/3/23 15:26:00 -- 周末都这么给力,感谢大佬,辛苦了! |