日期:2014-05-20  浏览次数:20464 次

@@@@@@@ 页面没有查询时,分页是正常的,但是在查询后,再翻页出现问题,显示的是总的纪录不是查询的纪录。一直搞不定。
Private   Sub   Page_Load(ByVal   sender   As   System.Object,   ByVal   e   As   System.EventArgs)   Handles   MyBase.Load
                If   (Not   Page.IsPostBack)   Then
                     
                        cmd   =   New   SqlCommand( "[dbo].[Page_RebResult] ",   Conn)
                        cmd.CommandType   =   CommandType.StoredProcedure
                        cmd.Parameters.Add( "@pageindex ",   1)
                        cmd.Parameters.Add( "@pagesize ",   1)
                        cmd.Parameters.Add( "@docount ",   True)
                        cmd.Parameters.Add( "@username ",   User.Identity.Name)

                        conn.Open()
                        AspNetPager1.RecordCount   =   cmd.ExecuteScalar()
                        conn.Close()
                        BindData()

                        End   If
                '在此处放置初始化页的用户代码
        End   Sub
        Sub   AddCustomText()
                aspnetpager1.CustomInfoText   =   "记录总数: <font   color= 'blue '> <b> "   +   aspnetpager1.RecordCount.ToString()   +   " </b> </font> "
                aspnetpager1.CustomInfoText   +=   "   总页数: <font   color= 'blue '> <b> "   +   aspnetpager1.PageCount.ToString()   +   " </b> </font> "
                aspnetpager1.CustomInfoText   +=   "   当前页: <font   color= 'red '> <b> "   +   aspnetpager1.CurrentPageIndex.ToString()   +   " </b> </font> "
                'Session( "page ")   =   aspnetpager1.CurrentPageIndex.ToString()
        End   Sub
        Sub   BindData()
                cmd   =   New   SqlCommand
                cmd.Connection   =   Conn
                cmd.CommandType   =   CommandType.StoredProcedure
                If   Not   (ViewState( "doSearch ")   Is   Nothing)   Then
                        cmd   =   New   SqlCommand( "Result_Qery ",   Conn)