复仇者联盟2演员名单:asp.net分页问题

来源:百度文库 编辑:高校问答 时间:2024/04/28 07:19:17
Sub getfull()
Dim d As String = "select * from cpxs "
Dim bb As OleDbCommand = New OleDbCommand
bb.CommandText = d
bb.Connection = conn
If conn.State = ConnectionState.Closed Then
conn.Open()
End If
Dim red As OleDbDataReader
red = bb.ExecuteReader

DataGrid1.DataSource = red
DataGrid1.DataBind()
Label1.Text = "当前为第:" + (DataGrid1.CurrentPageIndex + 1).ToString + "页"

Label2.Text = "共:" + DataGrid1.PageCount.ToString + "页"

red.Close()
Private Sub LinkButton5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LinkButton5.Click
DataGrid1.CurrentPageIndex = 0

getfull()
End Sub

Private Sub LinkButton2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LinkButton2.Click

If DataGrid1.CurrentPageIndex > 0 Then
DataGrid1.CurrentPageIndex = DataGrid1.CurrentPageIndex - 1

End If
getfull()

End Sub

Private Sub LinkButton3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LinkButton3.Click
If DataGrid1.CurrentPageIndex < (DataGrid1.PageCount - 1) Then
DataGrid1.CurrentPageIndex = DataGrid1.CurrentPageIndex + 1

End If

getfull()
End Sub

Private Sub LinkButton4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LinkButton4.Click
DataGrid1.CurrentPageIndex = (DataGrid1.PageCount - 1)
getfull()
End Sub

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
If (TextBox7.Text.Trim() <> "") Then

Dim PageI As Int32 = Int32.Parse(TextBox7.Text.Trim()) - 1
If PageI >= 0 And PageI < DataGrid1.PageCount Then
DataGrid1.CurrentPageIndex = PageI
getfull()
End If
End If
哪里有错误,不能翻页,请高手指点,感谢