---
title: "How to update Linq different table after join process"  
description: "How to update Linq different table after join process"  
author: "Norman Reedus"  
published: 2015-01-29  
updated: 2015-01-29  
canonical: https://www.mindstick.com/forum/12914/how-to-update-linq-different-table-after-join-process  
category: "asp.net"  
tags: ["c#", "linq", "sql server", "join"]  
reading_time: 2 minutes  

---

# How to update Linq different table after join process

I have combined 3 of my [tables](https://www.mindstick.com/articles/336597/introduction-of-html-tables-for-web-development) by using [linq](https://www.mindstick.com/articles/12007/language-integrated-query-linq-queries) [join](https://www.mindstick.com/articles/1487/join-sleep-and-interrupt-methods-in-c-sharp-threading). After that i want to [update](https://www.mindstick.com/forum/156353/what-is-hummingbird-update) this [table](https://www.mindstick.com/articles/43918/how-to-design-table-using-bootstrap) by using [data](https://www.mindstick.com/articles/13050/salesforce-aiming-to-dominate-predictive-analytics-with-data-science) that i get from webform. How can i do this ? My [implementation](https://www.mindstick.com/forum/33764/how-to-implementation-of-class-in-c-sharp) is below

```
public void updateShoes(Shoe shoe) {    var query = from b in db.BrandTbls.AsQueryable()                join m in db.ShoeModelTbls on b.BrandID equals m.BrandID                join s in db.ShoeTbls on m.ModelID equals s.ModelID                where shoe.ShoeID == s.ShoeID                 orderby m.ModelName                select new                 {                     s.ShoeID,                    s.Size,                    s.PrimaryColor,                    s.SecondaryColor,                    s.Quantity,                    m.ModelName,                    m.Price,                    b.BrandName                };}
```

## Replies

### Reply by David Miller

Though your approach is a little bit unclear right now (for e.g. we don't know which entities you are trying to update), however you can modify your code like this,

```
public void updateShoes(Shoe shoe) {    var query = from b in db.BrandTbls.AsQueryable()            join m in db.ShoeModelTbls on b.BrandID equals m.BrandID            join s in db.ShoeTbls on m.ModelID equals s.ModelID            where shoe.ShoeID == s.ShoeID             orderby m.ModelName            select new             {                 Shoe = shoe, Brand = b, Model = m            };     foreach(var o in query)    {        o.Shoe.ColorName = "Black";        o.Brand.BrandName = "New Branding";        o.Model.ModelName = "Something else";    }     db.SaveChanges();}
```

Rather picking selected properties from each Entity, you can pick whole entity. Then you can update each entity in a loop as I have doing above.


---

Original Source: https://www.mindstick.com/forum/12914/how-to-update-linq-different-table-after-join-process

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
