【发布时间】:2013-02-27 12:30:47
【问题描述】:
我想将 SQL 查询转换为 ADO.NET Entity Framework LINQ 查询。我正在使用 MySQL。
SQL:
Update Not As n
Inner Join user As a
On a.UserId = n.Not_UserId
Set Not_Checked='0'
Where n.Not_Checked='1'
And n.Not_UserId='" + Not_UserId + "'
LINQ:
var n5 = from u in db.user
join n in db.not
on u.UserId equals n.Not_UserId
where n.Not_Checked==1 && n.Not_UserId==4
select new
{
u,
n
};
我想更新n 的值。我试过n5.n,但没用。如何使用 LINQ EF 更新n?
【问题讨论】:
-
我尝试 n5.n 但它不起作用你能解释一下吗?
-
我尝试了“n5.n.Not_Checked”,但它不起作用。我想到达“db.not”表下的“Not_Checked”字段。如果我到达这个字段,我想要更新。
-
@Conrad...非常正确...我戴上了 vb.net 帽子...谢谢!
标签: mysql entity-framework ado.net linq-to-entities