【问题标题】:where clause in entityDataSource with field from other table entityentityDataSource 中的 where 子句与来自其他表实体的字段
【发布时间】:2013-05-16 16:09:00
【问题描述】:

我有 3 个表格、产品、productspercategory 和 category。 您可以选择一个类别,然后您会列出该类别中的所有产品。

但我似乎无法让它发挥作用。

我正在使用实体框架,我创建了 2 个实体数据源,一个用于产品,一个用于产品类别。我已经从代码中的变量中的类别中获得了 ID。

我在 productspercategory entitydatasource 中添加了 where 参数。

 <WhereParameters>
                <asp:ControlParameter ControlID="categoryID" Name="category_id" PropertyName="Value" />
 </WhereParameters>

但现在我需要向 products 实体数据源添加 where 参数,以仅显示 productspercategory 实体数据源中的产品。 我该怎么做?

数据库结构:

Category 表包含:name、categoryID Productspercategory 表包含:id、categoryID、productID 产品表包含:productID、name

所以我想获取实体数据源中属于所选 categoryID 的所有产品名称

【问题讨论】:

    标签: c# sql entity-framework ado.net where-clause


    【解决方案1】:

    我使用 SQLdatasource 解决了这个问题

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-10-04
      • 1970-01-01
      • 2013-05-18
      • 2021-01-17
      • 1970-01-01
      • 1970-01-01
      • 2017-06-05
      • 1970-01-01
      相关资源
      最近更新 更多