GF17
GF17

Reputation: 1

LinqDataSource WHERE query - ASP.NET

For my project I'm using Visual Studio 2017 and SQL Server Express. The're 3 tables: 1. Table_Discount 2. Table_Discount_Organization 3. Table_Organization_Type

The tables are linked by ID's.

In my .aspx file the following code is present, which works fine... :

<asp:LinqDataSource ID="LinqDataSource3" runat="server" ContextTypeName="_03DEC2018_LINQ.UpdateDiscountDataContext" EntityTypeName="" Select="new (Discount_Descrip, Discount_Amount, Discount_Organization, Discount_Validity)" TableName="Table_Discounts" Where= "Discount_ID == 2">
        </asp:LinqDataSource>

However the above Where expression ("Discount_ID == 2") should be replaced with below functionality (SQL code):

SELECT Discount_Organization, Discount_Descrip, Discount_Amount
FROM Table_Discount, Table_Discount_Organization, Table_Organization_Type
WHERE Table_Discount.Discount_Organization_ID = Table_Discount_Organization.Discount_Organization_ID AND 
    Table_Discount_Organization.Discount_Organization_Type_ID = Table_Organization_Type.Organization_Type_ID AND
    Table_Organization_Type.Organization_Type_Name = 'Webshop'

I tried several things, but couldn't get it resolved. Any suggestions are welcome, thanks in advance.

Upvotes: 0

Views: 79

Answers (0)

Related Questions