2
Follows the code:
var resultado = db.Tabela
.Where(l => l.Nome == "João")
.Select(l => new { l.numero, l.cidade, l.estado, l.pais });
I know that in the database has "SP" value of the state field and I want to change the value "SP" to "São Paulo".
Here is the foreach
:
foreach (var item in resultado.Where(u => u.estado == "SP"))
{
item.estado= "São Paulo";
}
I get the following from error:
state' cannot be Assigned to -- it is read only
Some solution?
UPDATE:
I’ve tried that way:
var resultado = db.Tabela
.Where(l => l.Nome == "João")
.Select(l => new { l.numero, l.cidade, l.estado, l.pais }).ToList();
For:
for (int i = 0; i <resultado.Count; i++)
{
if (resultado[i].estado== "SP")
{
resultado[i].estado= "São Paulo";
}
}
and still remains the same error.
IS
Entity Framework
?– novic
@Virgilionovic, yes
– Matheus Miranda
see if it’s clear...
– novic
It was really good @Virgilionovic
– Matheus Miranda