0

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.

GF17
  • 1
  • Your source (`Table_Discounts`) doesn't match your SQL - can you provide more about it? – NetMage Jan 11 '19 at 22:22
  • The name Table_Discounts is a just placeholder for the SQL table , named Table_Discount. Despite the naming difference ( the 's' ), it works fine. However I don't understand how/where to define the other source tables, which should be used (Table_Discount_Organization and Table_Organization_Type) – GF17 Jan 11 '19 at 23:00
  • 1
    Possible duplicate of [LINQDataSource - Query Multiple Tables?](https://stackoverflow.com/questions/2838886/linqdatasource-query-multiple-tables) – NetMage Jan 12 '19 at 00:23

0 Answers0