复制//select * from //这一句是教何进行据分不能修改的了,因为它是教何进行据分从结果中读取,所以必须要用* //(select top @h_count (@filedlist) from @tableName .....) as big //取出符合条件的教何进行据分上限的记录 //where //big.guid //这里是亿华云关键,根据主键从下限结果中过滤掉重复的教何进行据分记录(只留下不同的数据,也就是教何进行据分求交集) //not in //(select top @l_count guid from @table .....)//下限 //order @orderby //原来的格式,云南idc服务商这里只保留了orderby之后的教何进行据分,应该保留条件之后所有的教何进行据分,包括gruopby什么的教何进行据分 函数类似如此: public string MakeSqlPager(string sourceSql,int pageIndex) { //使用默认页面大小 string orderbyStr=sourceSql.Substring(sourceSql.ToLower().IndexOf("order by")); int index=sourceSql.ToLower().IndexOf("select"); string bigRes="("+ sourceSql.Insert(index+6," top "+((pageIndex+1)*_pageSize).ToString()+" ")+") as big"; string smallRes="("+ sourceSql.Insert(index+6," top "+(pageIndex*_pageSize).ToString()+" ")+")"; return "select * from "+bigRes+" where big.guid not in "+smallRes+" "+orderbyStr; } 1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.