以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  如何将窗口中table2中的所有明细调入到table3中  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=180294)

--  作者:zyxhx
--  发布时间:2022/10/12 19:22:00
--  如何将窗口中table2中的所有明细调入到table3中
以下代码虽能正常运行,但只能复制一行明细数据,如何将table2表中的所有明细复制到table3表中呢,请老师指点,谢谢!

调入处方按钮代码:(能正常运行,但只能复制一行数据)

Dim t As Table = e.Form.Controls("Table2").Table
Dim t2 As Table = e.Form.Controls("Table3").Table
If  t.Rows.Count > 0 Then
    Dim nma() As String = {"货品编码","品名","规格","单位","数量","单价"} \'A表数据来源列
    Dim nmb() As String = {"货品编码","品名","规格","单位","数量","单价"} \'B表数据接收列
    Dim dr1 As Row = t2.AddNew()
    For i As Integer = 0 To nma.Length - 1
        dr1(nmb(i)) = t.Rows(0)(nma(i))
    Next
End If

附之前出错图片:

图片点击可在新窗口打开查看此主题相关图片如下:调入处方.png
图片点击可在新窗口打开查看

[此贴子已经被作者于2022/10/12 22:19:16编辑过]

--  作者:有点蓝
--  发布时间:2022/10/13 8:30:00
--  

    Dim nmb() As String = {"货品编码","品名","规格","单位","数量","单价"} \'B表数据接收列
for each r as row in t.Rows
    Dim dr1 As Row = t2.AddNew()
    For i As Integer = 0 To nma.Length - 1
        dr1(nmb(i)) = r(nma(i))
    Next
Next
End If

--  作者:zyxhx
--  发布时间:2022/10/13 8:59:00
--  
感谢老师!!!