DataTables("汇总表").DataRows.Clear
For Each s As String() In DataTables("明细表").GetValues("单位|产品","单位 is not null and 产品 is not null")
Dim dr As DataRow = DataTables("汇总表").AddNew
dr("单位") = s(0)
dr("产品") = s(1) dr("数量") = DataTables("明细表").Compute("Sum(数量)","单位='" & s(0) & "' and 产品 ='" & s(1) & "'")
dr("金额") = DataTables("明细表").Compute("Sum(金额)","单位='" & s(0) & "' and 产品 ='" & s(1) & "'")Next