开发者

Subsonic 3.0 Query limit with MySQL c#.net LinQ

开发者 https://www.devze.com 2022-12-28 09:31 出处:网络
a quick question which may or may not be easily answered. Currently, in order to return a limited result set of data to my calling reference using SubSonic I use a similar function as below:

a quick question which may or may not be easily answered.

Currently, in order to return a limited result set of data to my calling reference using SubSonic I use a similar function as below:

_DataSet = from CatSet in t2_aspnet_shopping_item_category.All()
                        join CatProdAssignedLink in t2_aspnet_shopping_link_categoryproduct.All() on CatSet.CategoryID equa开发者_运维问答ls CatProdAssignedLink.CategoryID
                        join ProdSet in t2_aspnet_shopping_item_product.All() on CatProdAssignedLink.ProductID equals ProdSet.ProductID
                        where ProdSet.ProductID == __ProductID
                        orderby CatProdAssignedLink.LinkID ascending                            
                        select CatSet;

and select the first item from the data set.

Is there a way to limit the lookup initially to a certain amount of rows? I'm using MySQL as the base database.


You can do that using following:

Using SubSonic:

If you want to get limited records from subsonic function then you can use GetPaged method to get records. To learn more about querying visit this link.

Use GetPaged instead of GetAll function in your query.

Using LINQ

Use Skip and Take methods to get limited records. To learn more about linq visit this link.

0

精彩评论

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

关注公众号