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

    How to combile 2 queries using LINQ ?


    Are you looking for a way to combine 2 queries using LINQ ? then read this thread to know more about it



    hi all

    I want to combine 2 queries in in one. I have following code and how will i write LINQ to combine it -

    var List = (from m in resellers
    select new SelectListItem
    {
    Text = m.Rr,
    Value = m.RrId.ToString(),
    Selected = m.rId == cId
    }).OrderBy(t => t.Text).ToList();

    ViewBag.rrs = List;

    How will I send or add above LINQ's output to my 2nd LINQ which is given below -


    reportsViewModel.MList = (from m in array //join p in rrs on m equals p.RrId

    select new MModel
    {
    mth = m.Key,
    views = m.Value
    }).OrderBy(t => rrs).ToList();

    I tried to join it but it is giving me an error....

    Thanks in advance.... any help is appreciated...
  • #744300
    Hi

    You can use Into statement for combine LINQ Queries


    Thanks
    Umesh Bhosale


  • Sign In to post your comments