分页排序
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;
}
{
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;
}