Coolite之数据源(store)分页,基于Sql2000存储过程(高效分页)

 思路:在读取数据表中的数据时无论读取多少行记录。我们最常用的是读取top N 到 topN+pageSize (通常按ID desc来取)。但分页有正序与倒序之分,具体怎么处理?先将代码粘出来,接下来再做详细说明。

 

引用网址:http://www.cnblogs.com/qyj0/archive/2009/11/11/1600959.html

 

protected void Store1_RefershData(object sender, StoreRefreshDataEventArgs e)
     {
       int Count = 0;
      Hidden1.Text = e.Limit.ToString();
      CheckLoad(ref Count, e.Start, e.Limit, int.Parse(groupID));
      this.Store1.DataBind();
        e.TotalCount = Count;
    }
     private void CheckLoad(ref int Count, int start, int limit, int  groupID)
     {
        string uName = txt_user.Text != "" ? "  and addUName like '%" + txt_user.Text + "%'  " : "";
        string title = txt_title.Text != "" ? "  and title like '%" + txt_title.Text + "%'  " : "";
        string mark = ta_Mark.Text != "" ? " and  content like '%" + ta_Mark.Text + "%'  " : "";
 
       ds = uD.Page_NumOut(limit, start, uName+title+mark+" and pass=1 and  classID= " +groupID+""0out   Count);
       if (ds != null && ds.Tables[0].Rows.Count > 0)
        {
            this.Store1.DataSource = ds;        }        else         {
            Count = 0;
            this.Store1.DataSource = "";
        }
   }
   #endregion
    RETURN @RecordCount
GO

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值