Foxtable(狐表)用户栏目专家坐堂 → [求助]批量复制


  共有8573人关注过本帖树形打印复制链接

主题:[求助]批量复制

帅哥哟,离线,有人找我吗?
狐狸爸爸
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47497 积分:251403 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2013/2/26 8:22:00 [显示全部帖子]

Dim r1 As Row = Tables("办单信息").Current
Dim r2 As Row = Tables("办单信息").AddNew
For Each c As Col In Tables("办单信息").Cols
    If c.name <> "PO号" Then
        r2(c.name) = r1(c.name)
    End If
Next

 回到顶部
帅哥哟,离线,有人找我吗?
狐狸爸爸
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:47497 积分:251403 威望:0 精华:91 注册:2008/6/17 17:14:00
  发帖心情 Post By:2013/2/26 10:09:00 [显示全部帖子]

这样就可以了:

 

 

Dim r1 As Row = Tables("办单信息").Current
Dim r2 As Row = Tables("办单信息").AddNew
For Each c As Col In Tables("办单信息").Cols
    If c.name <> "PO号" Then
        r2(c.name) = r1(c.name)
    End If
Next
Dim val As String =DataTables("办单信息").Compute("Max(PO号)")
val = val.SubString(2)
r2("PO号") = "R-" & cint(val+1)
For Each dr1 As DataRow In r1.DataRow.GetChildRows("办单物料明细表")
    Dim dr2 As DataRow = DataTables("办单物料明细表").AddNew()
    For Each dc As DataCol In DataTables("办单物料明细表").DataCols
        If dc.name <> "办单号" Then
            dr2(dc.name) = dr1(dc.name)
        End If
        dr2("办单号") = r2("PO号")
    Next
Next


 回到顶部