以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  狐爸帮我看看,根据条件表间赋值行  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=41506)

--  作者:hunanwl
--  发布时间:2013/10/21 13:24:00
--  狐爸帮我看看,根据条件表间赋值行
Dim sp As DataTable=DataTables("商品信息")
Dim ss As DataTable=DataTables("销售清单")
Dim Cols1() As String = {"sp.DataCols("商品编码")","sp.DataCols("商品名称")","sp.DataCols("单位")"}
Dim Cols2() As String = {"ss.DataCols("商品编码")","ss.DataCols("商品名称")","ss.DataCols("单位")"}
For Each dr1 As DataRow In DataTables("商品信息").Select("[商品编码]="0001")
    Dim dr2 As DataRow = DataTables("销售清单").AddNew()
    For i As Integer = 0 To Cols1.Length -1
        dr2(Cols2(i)) = dr1(Cols1(i))
    Next
Next


代码编译有错  不知是什么问题

我是参照以下帮助里的代码编写的
Dim Cols1() As String = {"来源列一","来源列二","来源列三"}
Dim 
Cols2() As String = {"接收列一","接收列二","接收列三"}
For Each 
dr1 As DataRow In DataTables("表A").Select("[金额] > 100")
    Dim 
dr2 As DataRow = DataTables("表B").AddNew()
    For 
i As Integer = 0 To Cols1.Length -1
        
dr2(Cols2(i)) = dr1(Cols1(i
))
    Next
Next
[此贴子已经被作者于2013-10-21 13:25:41编辑过]

--  作者:Bin
--  发布时间:2013/10/21 14:03:00
--  
Dim Cols1() As String = {"商品编码","商品名称","单位"}
Dim Cols2() As String = {"商品编码","商品名称","单位"}