Linq更新表数据
update dbo.Users set Online = 'false' where dateadd(minute,2,CreateDate)< getdate()
用Linq怎么写
在线等急急急
------解决方案--------------------var user=db.Users.Where(u=>u.CreateDate.AddMinutes(1)<DateTime.Now);
foreach(var u in user)
{
u.Online=false;
}
db.SubmitChanges();
------解决方案--------------------var user=db.Users.Where(u=>u.CreateDate.AddMinutes(
2)<DateTime.Now);
foreach(var u in user)
{
u.Online=false;
}
db.SubmitChanges();
好吧。。是2分钟。。。囧~~~