Foxtable(狐表)用户栏目专家坐堂 → 复制多行


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

主题:复制多行

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


加好友 发短信
等级:三尾狐 帖子:706 积分:4908 威望:0 精华:0 注册:2016/5/17 12:03:00
复制多行  发帖心情 Post By:2016/7/20 15:19:00 [只看该作者]

A表中输入一行或多行数据,通过一个按钮复制到B表,B表只比A表多了一个列,其他都一样,求怎么写代码;

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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/7/20 15:26:00 [只看该作者]


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


加好友 发短信
等级:三尾狐 帖子:706 积分:4908 威望:0 精华:0 注册:2016/5/17 12:03:00
  发帖心情 Post By:2016/7/20 16:24:00 [只看该作者]

If messagebox.show("数据将被复制到库存表,请确认准确与否","提示",MessageBoxButtons.YesNo,MessageBoxIcon.Warning) = DialogResult.Yes Then
    Dim Cols1() As String = {"入库日期","入库编号","入库日期统计","客户","订单号","克重","门幅","缸号","颜色","重量","匹数","仓位","销售人员","品名","入库类型","标注"}
    Dim Cols2() As String = {"入库日期","入库编号","入库日期统计","客户","订单号","克重","门幅","缸号","颜色","重量","匹数","仓位","销售人员","品名","入库类型","标注"}
    For Each dr1 As DataRow In DataTables("入库表").datarows
        If DataTables("库存表").Find("入库编号 = '" & r("入库编号") & "'") Is Nothing Then
            
            Dim dr2 As DataRow = DataTables("库存表").addnew()
            For i As Integer = 0 To Cols1.length -1
                dr2(Cols2(i)) = dr1(Cols1(i))
            Next
            dr2.save
        Next
    End If
End If

请问上面的代码有什么问题吗
 If DataTables("库存表").Find("入库编号 = '" & r("入库编号") & "'") Is Nothing Then 是不要重复的行再被复制到库存表,
好像感觉不完善
            

 回到顶部
帅哥哟,离线,有人找我吗?
大红袍
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/7/20 16:27:00 [只看该作者]

If messagebox.show("数据将被复制到库存表,请确认准确与否","提示",MessageBoxButtons.YesNo,MessageBoxIcon.Warning) = DialogResult.Yes Then
    Dim Cols1() As String = {"入库日期","入库编号","入库日期统计","客户","订单号","克重","门幅","缸号","颜色","重量","匹数","仓位","销售人员","品名","入库类型","标注"}
    Dim Cols2() As String = {"入库日期","入库编号","入库日期统计","客户","订单号","克重","门幅","缸号","颜色","重量","匹数","仓位","销售人员","品名","入库类型","标注"}
    For Each dr1 As DataRow In DataTables("入库表").datarows
        If DataTables("库存表").Find("入库编号 = '" & dr1("入库编号") & "'") Is Nothing Then
            Dim dr2 As DataRow = DataTables("库存表").addnew()
            For i As Integer = 0 To Cols1.length -1
                dr2(Cols2(i)) = dr1(Cols1(i))
            Next
            dr2.save
        End If
    Next
End If

 回到顶部