在.net中,大数据量下的列表显示分页如何处理?
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在.net中,大数据量下的列表显示分页如何处理?相关的知识,希望对你有一定的参考价值。
Private Sub DlistBind(ByVal SqlStr As String, ByVal Dlst As DataList, ByVal PgNum As Integer)Dim Conn As New SqlConnection(ConnStr)
Conn.Open()
Dim Adpt As New SqlDataAdapter(SqlStr, Conn)
Dim Ds As New DataSet
Adpt.Fill(Ds, "iTable")
Dim TotalRec As Integer = Ds.Tables.Item(0).Rows.Count
ShowTotalRec.Text = "当前共 " & TotalRec & " 部作品"
Dim TotalPage As Integer
If TotalRec < Pagec Then
TotalPage = 1
Else
If TotalRec Mod Pagec <> 0 Then
TotalPage = TotalRec \ Pagec + 1
Else
TotalPage = TotalRec / Pagec
End If
End If
ShowTotalPage.Text = TotalPage
ShowCurrentPage.Text = PgNum
Dim Tempi As DataTable = Ds.Tables.Item(0).Clone
Dim m, n As Integer
For m = (PgNum - 1) * Pagec To PgNum * Pagec - 1
If m < 0 Or m > Ds.Tables.Item(0).Rows.Count - 1 Then Exit For
Dim Row As DataRow = Tempi.NewRow()
For n = 0 To Ds.Tables.Item(0).Columns.Count - 1
Row(Ds.Tables.Item(0).Columns(n).ColumnName) = Ds.Tables.Item(0).Rows.Item(m).Item(n)
Next
Tempi.Rows.Add(Row)
Next
Dlst.DataSource = Tempi.DefaultView
Dlst.DataBind()
Conn.Close()
End Sub 参考技术A vs.net里面有个选项的啊,可以选择是否要分页
以上是关于在.net中,大数据量下的列表显示分页如何处理?的主要内容,如果未能解决你的问题,请参考以下文章