此分页是采用存储过程进行分页的,本地测试没问题,放到服务器上运行,分页出错,点击下一页不能到达真正的下一页,请大家帮忙看看是那里出了问题:.aspx.csprivate static DataSet ALLGetCustomersData(string url,string re,string province,string city,int pageIndex,int pageSize,ref int recordCount,ref int pageCount) {
string ConnStr=System.Configuration.ConfigurationSettings.AppSettings["ConnStr"];

SqlConnection conn = new SqlConnection(ConnStr);

SqlCommand comm = new SqlCommand("GetCustomersDataPage",conn);
comm.Parameters[8].Value = Customer_address; comm.Parameters.Add(new SqlParameter("@url",SqlDbType.NVarChar)); comm.Parameters[9].Value = url; comm.Parameters.Add(new SqlParameter("@re",SqlDbType.NVarChar)); comm.Parameters[10].Value = re; comm.Parameters.Add(new SqlParameter("@province",SqlDbType.NVarChar)); comm.Parameters[11].Value = province; comm.Parameters.Add(new SqlParameter("@city",SqlDbType.NVarChar)); comm.Parameters[12].Value = city; comm.Parameters.Add(new SqlParameter("@PageIndex",SqlDbType.Int)); comm.Parameters[13].Value = pageIndex; comm.Parameters.Add(new SqlParameter("@PageSize",SqlDbType.Int)); comm.Parameters[14].Value = pageSize; comm.Parameters.Add(new SqlParameter("@RecordCount",SqlDbType.Int)); comm.Parameters[15].Direction = ParameterDirection.Output; comm.Parameters.Add(new SqlParameter("@PageCount",SqlDbType.Int)); comm.Parameters[16].Direction = ParameterDirection.Output; comm.CommandType = CommandType.StoredProcedure; SqlDataAdapter dataAdapter = new SqlDataAdapter(comm); DataSet ds = new DataSet(); dataAdapter.Fill(ds); recordCount = (int)comm.Parameters[15].Value; pageCount = (int)comm.Parameters[16].Value; conn.Dispose(); return ds; }  private void LBtnNavigation_Click(object sender, System.EventArgs e) { LinkButton btn = (LinkButton)sender; switch(btn.CommandName) { case "First": PageIndex = 0; break; case "Prev"://if( PageIndex > 0 ) PageIndex = PageIndex - 1; break; case "Next"://if( PageIndex < PageCount -1) PageIndex = PageIndex + 1; break; case "Last": PageIndex = PageCount - 1; break; } BindToDataGridCustomer();               } public void SetPagingState() { if( PageCount <= 1 )//( RecordCount <= PageSize )//小于等于一页 { this.LBtnFirst.Enabled = false; this.LBtnPrev.Enabled = false; this.LBtnNext.Enabled = false; this.LBtnLast.Enabled = false; } else //有多页 { if( PageIndex == 0 )//当前为第一页 { this.LBtnFirst.Enabled = false; this.LBtnPrev.Enabled = false; this.LBtnNext.Enabled = true; this.LBtnLast.Enabled = true;                                     } else if( PageIndex == PageCount - 1 )//当前为最后页  { this.LBtnFirst.Enabled = true; this.LBtnPrev.Enabled = true; this.LBtnNext.Enabled = false; this.LBtnLast.Enabled = false;                                    } else //中间页 { this.LBtnFirst.Enabled = true; this.LBtnPrev.Enabled = true; this.LBtnNext.Enabled = true; this.LBtnLast.Enabled = true; } }          this.LtlPageSize.Text = PageSize.ToString(); this.LtlRecordCount.Text = RecordCount.ToString(); if(RecordCount == 0) { this.LtlPageCount.Text = "0"; this.LtlPageIndex.Text = "0"; }     else { this.LtlPageCount.Text = PageCount.ToString(); this.LtlPageIndex.Text = (PageIndex + 1).ToString(); } }
          public int PageCount { get { return this.DataGridCustomer.PageCount; }     }
public int PageSize { get { return this.DataGridCustomer.PageSize; }              }
public int PageIndex { get { return this.DataGridCustomer.CurrentPageIndex; } set { this.DataGridCustomer.CurrentPageIndex = value; } } 
public int RecordCount { get { return recordCount; }              }sql 存储过程:CREATE PROCEDURE [GetCustomersDataPage]          @url varchar(1000),
         
         @re varchar(1000),
         
         @province varchar(1000),
         
         @city varchar(1000),
 
         @PageIndex INT,         @PageSize  INT,
          
         @RecordCount INT OUT,         @PageCount INT OUTASSELECT @RecordCount = COUNT(*)  FROM customer where City like '%'+@city+'%' and Province like '%'+@province+'%' and Re like '%'+@re+'%'and url like '%'+@url+'%'SET @PageCount = CEILING(@RecordCount * 1.0 / @PageSize) DECLARE @SQLSTR NVARCHAR(3000)IF @PageIndex = 0 OR @PageCount <= 1         SET @SQLSTR =N'SELECT TOP '+STR( @PageSize )+'  Customer.Customer_id,csort.csort_name,Customer.Customer_name,Customer.Address FROM   Customer ,csort where customer.Re like ''%'+@re+'%''and  customer.url like ''%'+@url+'%'' and customer.Province like ''%'+@province+'%'' and customer.City like ''%'+@city+'%'' order by customer.Customer_id desc'ELSE IF     @PageIndex = @PageCount - 1                      SET @SQLSTR =N' SELECT * FROM ( SELECT TOP '+STR( @RecordCount - @PageSize * @PageIndex )+'  Customer.Customer_id,csort.csort_name,Customer.Customer_name,Customer.Address  FROM   Customer ,csort where customer.csort_id=csort.csort_id and customer.url like ''%'+@url+'%'' and customer.Re like ''%'+@re+'%''and customer.url like ''%'+@url+'%'' and customer.Province like ''%'+@province+'%'' and customer.City like ''%'+@city+'%'' ) TempTable ORDER BY Customer_id DESC'ELSE                  SET @SQLSTR =N' SELECT TOP  '+STR( @PageSize )+' * FROM ( SELECT TOP '+STR( @RecordCount - @PageSize * @PageIndex )+'  Customer.Customer_id,csort.csort_name,Customer.Customer_name,Customer.Address  FROM   Customer ,csort where customer.csort_id=csort.csort_id and customer.url like ''%'+@url+'%'' and customer.Re like ''%'+@re+'%''and customer.url like ''%'+@url+'%'' and customer.Province like ''%'+@province+'%'' and customer.City like ''%'+@city+'%'' ) TempTable ORDER BY Customer_id DESC'EXEC (@SQLSTR)GO