Foxtable(狐表)用户栏目专家坐堂 → 提取填充重复或顺序改变


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

主题:提取填充重复或顺序改变

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


加好友 发短信
等级:童狐 帖子:220 积分:1893 威望:0 精华:0 注册:2013/5/20 23:54:00
提取填充重复或顺序改变  发帖心情 Post By:2021/4/21 14:18:00 [只看该作者]

Dim Cols1() As String = {"工号","件号","零件图号","名称及规格","单台数量","合计数量","材质名称","材检编号","工艺路线","到位日期","到位数量","入库日期","入库数量","序1","序2","序3","序4","序5","序6","序7","序8","序9","序10","序11","序12","序13","序14","序15","序16","序17","序18","序19","序20"}
Dim Cols2() As String = {"工号","件号","零件图号","名称及规格","单台数量","合计数量","材质名称","材检编号","工艺路线","到位日期","到位数量","入库日期","入库数量","序1","序2","序3","序4","序5","序6","序7","序8","序9","序10","序11","序12","序13","序14","序15","序16","序17","序18","序19","序20"}
For Each dr1 As DataRow In DataTables("零件台账").Select("[工号] > '0'")
    Dim dr2 As DataRow = DataTables("零件明细").AddNew()
    For i As Integer = 0 To Cols1.Length -1
        dr2(Cols2(i)) = dr1(Cols1(i))
    Next
Next

老师,以上代码无法判断重复值,用了重复值得判断代码后,顺序要变

Dim Cols3() As String = {"试样编号","技术条件","屈服强度","抗拉强度","伸长率","收缩率","冲击功","硬度","晶粒度","弯曲","组织","试样状态"}
Dim Cols4() As String = {"试样编号","技术条件","屈服强度","抗拉强度","伸长率","收缩率","冲击功","硬度","晶粒度","弯曲","组织","试样状态"}
For Each dr1 As DataRow In DataTables("试样台账").Select("[技术条件] > '0'")
    Dim dr2 As DataRow = DataTables("试样性能").Find("试样编号 = '" & dr1("试样编号") & "'")
    If dr2 Is Nothing Then
        dr2 = DataTables("试样性能").AddNew()
    End If
    For i As Integer = 0 To Cols3.Length -1
        dr2(Cols4(i)) = dr1(Cols3(i))
    Next
Next

请教下需要怎么改?


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


加好友 发短信
等级:超级版主 帖子:110443 积分:562081 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2021/4/21 14:22:00 [只看该作者]

For Each dr1 As DataRow In DataTables("试样台账").Select("[技术条件] > '0'","_sortkey") 

如果没有_sortkey列,改为_Identify

 回到顶部