开发者

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 开发者_StackOverflow中文版in order to make SKIP work like in SQL Server 2008. I just hope SP1 will be available soon :)


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)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜