日期:2014-05-18 浏览次数:20443 次
var select =( from ps in user.TUsers // where (ps.UserName.StartsWith("t")) orderby ps.id descending select new { id = ps.id.ToString(), name = ps.UserName, pass = ps.Password }).Skip(2).Take(5);
select *from ( select TUsers.id,TUsers.UserName,TUsers.Password,Row_Number()over(order by id desc) as rn, from TUsers )as ps where(ps.rn>=@Index and ps.rn<@Index+@Count)
select a.ID,a.Name from TUsers a inner join ( select rownum,ID,Name,TypeID,BrandID from (select ROW_NUMBER() over(order by id) rownum,ID,Name,TypeID,BrandID from TUsers ) t where rownum between 0 and 10) as b on a.ID=b.ID order by b.rownum
------解决方案--------------------
linq比lz的sql快
------解决方案--------------------
调试时看下生成的SQL语句
------解决方案--------------------
那是相当的快!