//分页select * from (select ROW_NUMBER() over(order by id asc) as 'rowNumber', * from tb_User) as temp where rowNumber between (((@pageindex-1)*@pagesize)+1) and (@pageindex*@pagesize) public IEnumerable <T> FindPageList <T>(string where, int pageIndex, int pageSize, out int total, string sort = "") where T : new() { map = GetDataMap <T>(); DBProviderHelper db = new DBProviderHelper(); var jointSql = dbprovider.JointSql(map.tableName, map.GetColumnMapListStr(), where, sort); var start = ((pageIndex - 1) * pageSize) + 1; var end = (pageIndex * pageSize); string querySql = dbprovider.GetPageListSql(jointSql); DbParameter[] param = dbprovider.GetParameter(start, end, pageSize); //先获取记录总数 total = GetCount("select count(1) from " + map.tableName + " " + where); return(this.QueryCommandList <T>(querySql, param)); }