I have a table in my SQLServer database with almost 100K records in it and a web application in which I want to show a paged gridView presentation of these rows. Clearly I should filter the rows and return a small subset of them to client(because of the Ajax performance on web).
Here’s my main problem. What’s the best approach to select the middle rows? For example How can I select the rows from #50000 to #50010? Is there a way like select top 10 or select bottom 10 that selects the rows from middle of the table rows.
I’m using linq2sql in a .NET MVC web application & also can code SQL StoredProcedures.
Any suggestion will be appreciated.
In
Linq2Sqlthis is not that hard. You can use:Scott Guthrie has a post on this matter, which has some more explanation. And
Linq2Sqlwill actually produce sql usingROW_NUMBER().Some small hint, the order of your expressions is important:
.Where().Select().OrderBy().Skip().Take()