Dim dtt As DataTable = DataTables("入库单明细2_入库明细表")
Dim Total As Integer
Dim Customers As List(Of String)
Customers = dtt.GetValues("商品编号")
Dim cmd As New SQLCommand
Dim dt As DataTable
Dim dth As DataTable
cmd.CommandText = "Select 入库数量,商品编号 From {商品信息} "
dt = cmd.ExecuteReader
Dim Products As List(Of String)
For Each Customer As String In Customers
Products = dt.GetValues("入库数量","商品编号 = '" & customer & "'")
Total = dtt.Compute("Sum(数量)", "[商品编号] = '" & Customer & "'")
cmd.CommandText = "Select [_Identify],入库数量 From {商品信息} Where 商品编号 = '" & Customer & "'"
dth = cmd.ExecuteReader(True)
For Each dr As DataRow In dth.DataRows
For Each dttt As Integer In products
'Output.Show(Customer & ":" & dttt + Total ) '这个显示正常,能得到正常数值,这个计算出 : dttt 为入库明细表数量 + Total后台商品信息表入库数量 两个相加为最新库存量
dr("入库数量") = dttt + Total '现要把相加的最新库存量,更新到后台数据,这个问题要怎么处理,
cmd.ExecuteScalar '更新后台总数量
Next
dt.Save()
Next
Next
[此贴子已经被作者于2014-5-14 16:14:18编辑过]