If e.DataCol.Name = "审核"
If e.DataRow("审核") = True Then
Dim nma() As String = {"编号","抄表日期","项目","项目ID"} 'A表数据来源列
Dim nmb() As String = {"编号","抄表日期","项目","项目ID"} 'B表数据接收列
Dim aaa() As String = {"一号楼","二号楼","三号楼"}
e.DataRow.save
for each a as string in aaa
Dim dr2 As DataRow = DataTables("汇总").Find("编号 = '" & e.DataRow("编号") & "' and 楼号='" & a & "'") '找到指定返回的行
If dr2 Is Nothing Then
Dim dr3 As DataRow = DataTables("汇总").AddNew
For i As Integer = 0 To nma.Length - 1
dr3(nmb(i)) = e.DataRow(nma(i))
Next
dr3("ID") = e.DataRow(a & "_ID") dr3("上期") = e.DataRow(a & "_上期")
……其它列自己补充完整
' dr("来源") = "销售" '入库表就改为"采购",其他表改为"其它"
End If
next
Else