Stefan P.
Stefan P.

Reputation: 9519

How to paginate a query result with EF 4 and SQL Server CE 3.5

Since SKIP clause is not supported by SQL Server Compact 3.5 is there any way to accomplish paging?

EDIT:

To accomplish paging in Sql CE using only EF is not possible right now, Visual Studio 2010 SP1 will add SQL CE 4 and an update to EF 4 in order to make SKIP work like in SQL Server 2008. I just hope SP1 will be available soon :)

Upvotes: 2

Views: 1179

Answers (1)

Darkwing
Darkwing

Reputation: 7595

Offset and Fetch seem to be supported in SQL Server Compact 4

http://www.mikesdotnetting.com/Article/150/Web-Pages-Efficient-Paging-Without-The-WebGrid

That might not help you though:

Often paging is accomplished with the ROW_NUMBER() function.

SELECT field1 ,field2
FROM     (SELECT ROW_NUMBER() OVER (ORDER BY field1 ASC)
             AS Row, field1 ,field2  FROM table 
WHERE field1.name = 'foo')
            AS table
WHERE  Row >= 299 AND Row <= 355

But I'm not sure if thats supported in CE: Here's an existing thread:

Data paging in SQL Server CE (Compact Edition)

Upvotes: 1

Related Questions