Foxtable(狐表)用户栏目专家坐堂 → [讨论]如何筛选出符合条件的最后几条连续的记录


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

主题:[讨论]如何筛选出符合条件的最后几条连续的记录

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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/6/21 21:30:00 [显示全部帖子]

参考代码

 

Dim t As Table = Tables("表B")
Dim drs As List(of DataRow) = t.DataTable.Select("", "_Identify desc")
Dim str As String = ""
For i As Integer = 0 to drs.count-1
    Dim dr As DataRow = drs(i)
    If dr("第二列") = "A" Then
        For j As Integer = i To drs.count-1
            dr = drs(j)
            If dr("第二列") = "A" Then
                str &= dr("_Identify") & ","
            Else
                goto out
            End If
        Next
    End If
Next

out:
msgbox(str.trim(","))


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


加好友 发短信
等级:贵宾 帖子:39310 积分:196782 威望:0 精华:1 注册:2015/4/25 9:23:00
  发帖心情 Post By:2016/6/22 10:58:00 [显示全部帖子]

无语

 

Dim t As Table = Tables("表B")
Dim drs As List(of DataRow) = t.DataTable.Select("", "_Identify desc")
Dim str As String = "-1,"
For i As Integer = 0 To drs.count-1
    Dim dr As DataRow = drs(i)
    If dr("第二列") = "A" Then
        For j As Integer = i To drs.count-1
            dr = drs(j)
            If dr("第二列") = "A" Then
                str &= dr("_Identify") & ","
            Else
                goto out
            End If
        Next
    End If
Next

out:
t.Filter = "_Identify in (" & str.trim(",") & ")"


 回到顶部