locked
using LIKE in a linqdatasource RRS feed

  • Question

  • User472280583 posted

    So I need to take the literal "SELECT....FROM Bay....WHERE Warehouse=1 and ((BAY LIKE '1.0%' or BAY LIKE '2.0%'))

    I have set up a linqdatasource on my asp page and I want to bind that to a gridview.  Here is the start of the HTML:

    <asp:LinqDataSource ID="dsBays" runat="server" ContextTypeName="CartonInventory.CartonInventoryDataContext" EnableUpdate="True" EntityTypeName="" OrderBy="Sort" TableName="Bays" Where="Warehouse == @Warehouse">

    <WhereParameters>

      <asp:Parameter DefaultValue="True" Name="Warehouse" Type="Boolean" />

    </WhereParameters>

    </asp:LinqDataSource>

    How do I add a parameter so that it includes the LIKE statement?

    Thanks 

    Tuesday, November 16, 2010 2:09 PM

Answers

  • User1508394307 posted

    Where='Warehouse == @Warehouse && (Bay.StartsWith("1.0") || Bay.StartsWith("2.0"))'

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, November 16, 2010 3:51 PM