分页排序

   public IList<Article> GetArticleAll(int startRowIndex, int maximumRows, string sortstr)
        {
            int pa1 = (startRowIndex - 1) * maximumRows + 1;
            int pa2 = startRowIndex * maximumRows;
            string sqlstr = string.Format("SELECT * FROM (SELECT *,ROW_NUMBER() OVER(ORDER BY {0} DESC) AS rowNum  FROM article) AS D WHERE rowNum  BETWEEN {1} AND {2}", new object[] { sortstr, pa1, pa2 });
            IList<Article> list = null;
            list = GetArticleAll(sqlstr);
            return list;
        }
posted @ 2009-01-20 12:25  Dacey  Views(140)  Comments(0Edit  收藏  举报