Why do LINQ to Entities does not recognize certain Methods?
Posted
by Luiscencio
on Stack Overflow
See other posts from Stack Overflow
or by Luiscencio
Published on 2010-03-17T22:56:29Z
Indexed on
2010/03/17
23:01 UTC
Read the original article
Hit count: 305
Why cant I do this:
usuariosEntities usersDB = new usuariosEntities();
foreach (DataGridViewRow user in dgvUsuarios.Rows)
{
var rowtoupdate =
usersDB.usuarios.Where(
u => u.codigo_usuario == Convert.ToInt32(user.Cells[0].Value)
).First();
rowtoupdate.password = user.Cells[3].Value.ToString();
}
usersDB.SaveChanges();
And have to do this:
usuariosEntities usersDB = new usuariosEntities();
foreach (DataGridViewRow user in dgvUsuarios.Rows)
{
int usercode = Convert.ToInt32(user.Cells[0].Value);
var rowtoupdate =
usersDB.usuarios.Where(u => u.codigo_usuario == usercode).First();
rowtoupdate.password = user.Cells[3].Value.ToString();
}
usersDB.SaveChanges();
I must admint it is a more readable code but why cant this be done?
© Stack Overflow or respective owner