【问题标题】:Subsonic 3.0 Query limit with MySQL c#.net LinQSubsonic 3.0 查询限制与 MySQL c#.net LinQ
【发布时间】:2010-04-29 11:42:12
【问题描述】:

一个简单的问题,可能容易回答,也可能不容易回答。

目前,为了使用 SubSonic 将有限的数据结果集返回给我的调用引用,我使用了如下类似的函数:

_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;

并从数据集中选择第一项。

有没有办法将查找最初限制为一定数量的行?我使用 MySQL 作为基础数据库。

【问题讨论】:

    标签: mysql linq subsonic3 limit


    【解决方案1】:

    您可以使用以下方法做到这一点:

    使用 SubSonic:

    如果你想从亚音速函数中获取有限的记录,那么你可以使用GetPaged 方法来获取记录。了解更多关于查询visit this link的信息。

    在您的查询中使用 GetPaged 而不是 GetAll 函数。

    使用 LINQ

    使用SkipTake 方法获取有限的记录。了解更多关于 linq 的信息visit this link

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-09-14
      • 2011-02-20
      • 1970-01-01
      相关资源
      最近更新 更多