Dim dt1,dt2 As DataTable
Dim dr1,dr2 As DataRow
dt1 = DataTables("入库单")
dt2 = DataTables("库存表")
Dim Arys As List(of String) = dt1.GetUniqueValues("","货号")
For Each Ary As String In Arys
If dt2.find("货号 = '"& Ary &"'") Is Nothing Then
dr2 = dt2.addnew
dr2("货号") = Ary
dr2("数量") = dt1.Compute("sum(数量)","货号 = '"& Ary &"'")
Else
dr2 = dt2.find("货号 = '"& Ary &"'")
dr2("数量") = dt1.Compute("sum(数量)","货号 = '"& Ary &"'")
End If
Next
[此贴子已经被作者于2012-11-11 15:44:41编辑过]