以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助] 怎么把两数组的值,赋给另一值  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=50858)

--  作者:hws005
--  发布时间:2014/5/14 16:12:00
--  [求助] 怎么把两数组的值,赋给另一值
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编辑过]

--  作者:Bin
--  发布时间:2014/5/14 16:13:00
--  
最后执行  dth.Save 就好了.代码没看出有问题.
--  作者:hws005
--  发布时间:2014/5/14 16:18:00
--  
大哥,牛,搞定,就缺个dth.save,  NND,搞死我了