Rss & SiteMap
Foxtable(狐表) http://www.foxtable.com
For Each dr As Datarow In DataTables("表A").DataRows
For Each dt1 As Datarow In DataTables("表B").DataRows
For Each dt As Datarow In DataTables("表C").DataRows
If dt IsNot Nothing Then
dr("第一列") = dt("第一列")
dr("第二列") = dr("第二列")
dr("第三列") = dt("第三列")-dt1("第三列")
dr("第四列") = dt("第四列") – dt1("第四列")
End If
next
next
next
说明:表A、表B、表C结构完全相同;表A第一列与表B第一列完全相同,表A第二列与表B第二列完全相同;第三四列等于相应表C行减去相应表B行的值。
下载信息 [文件大小: 下载次数: ] | |
点击浏览该文件:111.table |
Dim da As Row
DataTables("表C").DeleteFor("第一列 Is Null")
For i As Integer= 0 to Tables("表C").Rows.Count-1
da = Tables("表A").AddNew()
da("第一列") = Tables("表C")(i,"第一列")
da("第二列") = Tables("表C")(i,"第二列")
da("第三列") = Tables("表C")(i,"第三列")-Tables("表B")(i,"第三列")
da("第四列") = Tables("表C")(i,"第四列")-Tables("表B")(i,"第四列")
next
Dim da As Row
DataTables("表C").DeleteFor("第一列 Is Null")
For i As Integer= 0 to Tables("表C").Rows.Count-1
da = Tables("表A").AddNew()
da("第一列") = Tables("表C")(i,"第一列")
da("第二列") = Tables("表C")(i,"第二列")
da("第三列") = Tables("表C")(i,"第三列")-Tables("表B")(i,"第三列")
da("第四列") = Tables("表C")(i,"第四列")-Tables("表B")(i,"第四列")
next
谢谢杨大姐!想不到代码变化与先前想法差异这么大