/// <summary> /// 获取数据总量 /// </summary> /// <param name="filter">筛选条件</param> /// <returns></returns> public static int GetDataCount(Filter filter) { if (string.IsNullOrEmpty(filter.filterString)) { filter.filterString = "1=1"; } string sql = "select count(*) from {0} where {1};"; String sql_exe = string.Format(sql, filter.tableName, filter.filterString); var data = DataOperate.getds(sql_exe); return(int.Parse(data.Tables[0].Rows[0].ItemArray[0].ToString())); }
/// <summary> /// 获取分页数据 /// </summary> /// <param name="pageIndex">页码</param> /// <param name="pageSize">页容量</param> /// <param name="filter">筛选条件</param> /// <returns></returns> public static DataTable GetPageData(int pageIndex, int pageSize, Filter filter) { if (string.IsNullOrEmpty(filter.filterString)) { filter.filterString = "1=1"; } string sql = "select * from {0} where {3} limit {1},{2};"; String sql_exe = string.Format(sql, filter.tableName, pageIndex, pageSize, filter.filterString); var data = DataOperate.getds(sql_exe); return(data.Tables[0]); }