DataView获取top方法

'获取top数据
    Private Shared Function GetTopDataViewRows(ByVal dv As DataView, ByVal n As Integer) As DataView
        Dim dt As DataTable = dv.Table.Clone()

        Dim i As Integer = 0
        While i < n - 1
            If i >= dv.Count Then
                Exit While
            End If
            dt.ImportRow(dv(i).Row)
            System.Math.Max(System.Threading.Interlocked.Increment(i), i - 1)
        End While
        Return New DataView(dt, dv.RowFilter, dv.Sort, dv.RowStateFilter)
    End Function

posted @ 2010-11-23 17:29  草根站长李小冲  阅读(500)  评论(0编辑  收藏  举报