如何用代码实现把交叉统计的临时表的内容复制到正式表中?尝试好久,整不明白,能帮忙写下吗?
Dim Cols1() As String = { "项目归属", "项目编号", "开piao"}
Dim Cols2() As String = { "项目归属", "项目编号", "开piao"}
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
Next
此主题相关图片如下:微信截图_20240323144310.png
谢谢了
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