可以用LINQ to SQL编写这样的东西:
UPDATE Table1
SET CustomerName = t2.Name
FROM Table1 t1 JOIN Table2 t2
ON t1.TableID = t2.TableID
答案 0 :(得分:2)
var result = from t1 in context.Table1
join t2 in context.Table2 on t1.TableID = t2.TableID
select new {t1, t2};
result.ToList().ForEach(i => i.t1.CustomerName = i.t2.Name);
context.SubmitChanges();