views:

181

answers:

1

Hello,

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 equals 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.

A: 

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.

Krunal