You must Sign In to post a response.
  • Category: LINQ

    How to get Data from two table using Join in LIST?

    Please tell me how can i get the result using join

    my code is here....

    from A in _db.T1
    join B in _db.T2 on A.IM_ID equals B.IM_ID
    where A.PropertyID == PropertyID
    select new { A.IM_ID, B.IM_Rate, A.IM_Code, A.IM_Title }

    i want it in LIST but it will not return or if possible to return data in dataset.

    Atul Sharma
  • #746089
    Hai Atul,
    If you want the data should be returned as the List, then you need to create a list first by creating a class and then you can return the records and assign to the same class object so that it will have the records in the list and then you can do the operations to search, select etc.
    Hope it will be helpful to you.

    Pawan Awasthi(DNS MVM)
    +91 8123489140 (whatsApp), +60 14365 1476(Malaysia)

  • #746090
    Hi Atul Sharma,

    your requirements seems that you want the resultset data into dataset by using linq to sql joins

    Refer the following link

    Hope it will helpful

    Bhavana Ky

  • #746129
    I would suggest to create a Model class containg all the fields which you want to return from Query and then return the value as

    Var ReturnModelClassObject =

    (from A in _db.T1
    join B in _db.T2 on A.IM_ID equals B.IM_ID
    where A.PropertyID == PropertyID
    select new ModelClassname()

    Thanks & Regards
    Anil Kumar Pandey
    Microsoft MVP, DNS MVM

  • #747910
    If you want to return data from two table in list then you have to Create such a class including the fields you return.
    and then in select statement you have to return that fields in list.

    Umesh Bhosale

  • #747938
    Hi Bhavana, Anil and Umesh,
    please understand my problem then give answer, i want exactly , all records of five or more tables columns using join.

    i have already test this...


  • #747939
    Hi Anil,

    i have lot of records so that i want return all columns, please suggest another way.



  • Sign In to post your comments