asp.net repeater控件分页显示数据 很辣手!高手来帮帮我!

来源:百度知道 编辑:UC知道 时间:2024/05/11 17:05:48
第一次加载页面时可以,但点击下一页时,就出问题了!如:共:1/2页变成: 共:2/1页,应该是2/2页,而且没有任何数据显示!
代码:
Dim id As Integer = Request("id")
comdstr = "select * from bbs where tyid=" & id
comd = New SqlClient.SqlCommand(comdstr, objconn)
objconn.Open()
adp = New SqlClient.SqlDataAdapter
adp.SelectCommand = comd
ds = New DataSet
adp.Fill(ds, "mingxi")
Dim pd As System.Web.UI.WebControls.PagedDataSource = New PagedDataSource
pd.DataSource = ds.Tables("mingxi").DefaultView()
pd.AllowPaging = True
pd.PageSize = 10
Dim CurPage As Integer
If Not Request.QueryString("Page") Is Nothing Then
CurPage = Convert.ToInt32(Request.QueryString("Page"))
Else
CurPage = 1
End If
pd.CurrentPageIndex = CurPage - 1
lblCurre

你是想在一页中显示一个还是多个呀...如果是是一个就用
comdstr = "select top 1 * from bbs " 这样不就行了....其实做分页应该是用top来实现的..top 后面跟的数据就是你在一页中要显示的记录的条数....如果你用C#.NET的话,我可以给你全部的代码.....哈哈