编程论坛's Archiver

tcapple486 发表于 2007-11-25 22:13

求助各高手 版主 分页问题(网上找不到)

Sub show()
        If (Not IsPostBack) Then
            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 If
    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()是如何用 什么时候用--这有点迷惑

页: [1]

Powered by Discuz! Archiver 6.1.0  © 2001-2007 Comsenz Inc.