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编辑过]