public static class PagingWrapper { private const string SQLTEMPLATE = @"With TargetTable AS(select ROW_NUMBER() OVER (order by Temp.{1})as RowNumber,Temp.* from ({0}) as Temp) select * from TargetTable WHERE RowNumber between {2} and {3};Select count(*) from ({0}) Temp"; public static string Wrap(string sqlQuery, string SortExpression, int startRowIndex, int maximumRows) { if (string.IsNullOrEmpty(SortExpression)) throw new Exception("未指定排序列.");