This project is read-only.

Paging

Can use skip and limit/take keyword to execute a physical paging. If only want to limit the max records to return, can use top or limit keyword. but the top keyword and the skip, limit/take keyword are exclusive, can not work together.

Top

After the select keyword, can use top keyword to limit the max records to return.
var esql = "select top(1) p from Products as p";
db.CreateQuery(esql).Execute();

Skip and Limit/Take

Skip and Limit/Take clause is a part of select statement. Skip and limit/take can word toghter or not, skip and limit/take can be used alone, furthermore, the limit and take keywords are same.
Examples
var esql = "select p from Products as p skip 10";
var products = db.CreateQuery<Product>(esql).Execute();
var esql = "select p from Products as p limit 10";
var products = db.CreateQuery<Product>(esql).Execute();
Same as forward
var esql = "select p from Products as p take 10";
var products = db.CreateQuery<Product>(esql).Execute();
var esql = "select p from Products as p skip 10 limit 10";
var products = db.CreateQuery<Product>(esql).Execute();
Same as forward
var esql = "select p from Products as p skip 10 take 10";
var products = db.CreateQuery<Product>(esql).Execute();


Last edited Mar 9, 2013 at 7:57 AM by ansiboy, version 3

Comments

No comments yet.