Foxtable(狐表)用户栏目专家坐堂 → 老师,如果用GetValues列出数值,然后把第每个值用来筛选,15行以后的行全部删除怎么写?di


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

主题:老师,如果用GetValues列出数值,然后把第每个值用来筛选,15行以后的行全部删除怎么写?di

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2019/6/25 17:59:00 [显示全部帖子]

1、如果是sqlserver数据库,可以利用 row_number 给你表格编号,然后删除编号大于15的即可;

 

2、如果不是,只能遍历一次数据处理,如

 

Dim idx As String = "-1,"
Dim idx_temp As String = ""
Dim pdr As DataRow = Nothing
Dim count As Integer = 0
Dim cs As String = "第一列"
For Each dr As DataRow In DataTables("表A").Select("", "第一列")
    Dim flag As Boolean = False
    If pdr IsNot Nothing Then
        For Each c As String In cs.split(",")
            If pdr(c) <> dr(c) Then
                flag = True
                Exit For
            End If
        Next
    End If
    If flag OrElse pdr Is Nothing Then
        If count > 5 Then
            idx &= idx_temp
        End If
        count = 1
        idx_temp = ""
    Else
        count += 1
        If count > 5 Then
            idx_temp &= dr("_Identify") & ","
        End If
    End If
   
    pdr = dr
Next

If count > 5 Then
    idx &= idx_temp
End If

Tables("表A").filter = "_Identify in (" & idx.trim(",") & ")"

'Tables("表A").filter = "_Identify not in (" & idx.trim(",") & ")"  '显示唯一值


 回到顶部