/// <summary> /// access数据库分页 /// </summary> /// <typeparam name="T">实体</typeparam> /// <param name="page">页码</param> /// <param name="limit">每页条数</param> /// <param name="sql">查询sql</param> /// <param name="orderField">排序字段</param> /// <param name="orderType">排序类型</param> /// <returns></returns> protected IList<T> AccessPage<T>(int page, int limit, string sql, string orderField, string orderType) { string topSql = sql.Replace("SELECT", string.Format("SELECT TOP {0}", page * limit)); string pageSql = string.Format(@"SELECT * FROM (SELECT TOP {0} * FROM ({1} ORDER BY {2} {3}) ORDER BY {2} {4}) ORDER BY {2} {3}", limit, topSql, orderField, orderType, orderType.ToUpper() != "DESC" ? "DESC" : ""); return fsql.Ado.Query<T>(pageSql); }