求版主 各高手look~ look~
我的datagrid的分页功能用不了 代码都是参考网上的 而且都一样(基本)可就是不能 单击左右箭头 没有反应 Sub show()
Dim conn As SqlConnection
Dim ConnectionString As String = "server=(local);database=test;uid=sa;pwd= ;"
conn = New SqlConnection(ConnectionString)
Dim sql As String = "SELECT * From 会员表"
Dim myCommand As SqlCommand
Dim myDataDeader As SqlDataReader
myCommand = New SqlCommand(sql, conn)
conn.Open()
DataGrid1.DataSource = myCommand.ExecuteReader()
DataGrid1.DataBind()
conn.Close()
End Sub
Sub DataGrid1_page(ByVal sender As Object, ByVal e As DataGridPageChangedEventArgs)
Dim startIndex As Integer
startIndex = DataGrid1.CurrentPageIndex * DataGrid1.PageSize
DataGrid1.CurrentPageIndex = e.NewPageIndex
show()
End Sub
还有一个问题是 我想返回datagrid的页数到label 可就不成功 数值一直维持1不变
代码为Label1.Text = DataGrid1.PageCount 后该为Label1.Text = DataGrid1.PageCount.tostring() 都不成 顺便给我讲讲tostring()是如何用 什么时候用--这有点迷惑