日期:2014-05-17  浏览次数:20780 次

.net多表查询分页存储过程,第一页正常,第二页..都出错
后台调用分页代码:
 int currPage = 1;
        int PageSize =40;
        string tabeName = "TableOrders as a left join Customer as b on a.CustomerID=b.CustomerID  left join UseCompanyIp as c on a.OrderID=c.OrderID  left join Staff as e on a.StaffID=e.StaffID";
        string strFide = "(a.RenewalFee+a.ModificationCost) AS moneycount,a.PaymentCycle,a.ModificationCost,a.SerialNumber,a.state,a.Technology,a.RenewalStatus,a.RenewalFee,a.OldExpirationDate,a.RenewalDate,a.OrderID,a.OrderDate,a.ExpirationDate,a.Remarks,a.StaffID,a.CustomerID,a.PackageID,a.ProductID,b.CustomerName,b.Taofc,c.IpAddress,e.StaffName";
        string strSortKey = "a.OrderID";
        string strSortField = "a.ExpirationDate ";
        public void Bind()
        {

            int pageCount;
            int RecordCount;
         
            Repeater1.DataSource = tableorder.GetPagetable(tabeName, strFide, PageSize,currPage, out pageCount, out RecordCount, strSortField, strSortKey);

            Repeater1.DataBind();

            this.AspNetPager1.RecordCount = RecordCount;

            this.AspNetPager1.CurrentPageIndex = currPage;

            this.AspNetPager1.PageSize = PageSize;

        }






DAL层方法调用存储过程代码
   public DataTable GetPagetable(string TableNames, string Fields, int PageSize, int page, out int pageCount, out int RecordCount, string fldSort, string ID)
       {
           pageCount = 0;

           RecordCount = 0;
           DataTable datatable = new DataTable();
           using (SqlConnection conn = new SqlConnection(SQLHelper.scon))
           {
               SqlCommand objcmd = new SqlCommand("proc_ListPage", conn);

               objcmd.CommandType = CommandType.StoredProcedure;

               SqlParameter[] para ={

       new SqlPa