LinqDataSource Where Parameter

我与影子孤独终老i 提交于 2019-12-12 02:05:35

问题


I have the below query on my aspx page that works:

<asp:LinqDataSource ID="LinqDataSource1" runat="server" 
    ContextTypeName="InventoryDataContext" 
    EntityTypeName="" TableName="V_InventoryForDisplays" 
    Where="ConfiguredCarId == @ConfiguredCarId">
    <WhereParameters>
        <asp:Parameter DefaultValue="2827" Name="ConfiguredCarId" Type="Int32" />
    </WhereParameters>
</asp:LinqDataSource>

I need to change the Where clause to use a Contains statement. I have an auto-propertyЖ

public IEnumerable<int> ConfiguredCarIds { get; set; }

within the same class that I would like to use

so what is the proper syntax to do this:

Where="ConfiguredCarIds.Contains (ConfiguredCarId)"

Thanks!


回答1:


Try Where="ConfiguredCarId.Contains(@ConfiguredCarId)"



来源:https://stackoverflow.com/questions/6894654/linqdatasource-where-parameter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!