SubmitChanges () does not update data in Linq

0
internal bool AlterarCargo(string login, string Categoria)
{
    db.Log = Console.Out; //tentei ativar para ver se encontrava o erro mas não ajudou nada.
    var categoria = from x in db.Categorias
                    where x.Categorias == Categoria
                    select x.Id_Categorias;

    var Id_Inscricao = from x in db.DadosPessoaisComuns
            where x.login == login
            select x.Id_Inscricao;

    var query = from x in db.DadosCategorias
                where x.Id_Inscricao == Convert.ToInt16(Id_Inscricao.First())
                select x;

    foreach (var item in query)
    {
        item.Id_Categorias = categoria.First();
        MessageBox.Show(item.Id_Categorias.ToString() + "  " + item.Id_Inscricao.ToString());  // mostra os dados já atualizados
    }

    db.SubmitChanges();

    return true;
}

When I check the database the data has not been updated

    
asked by anonymous 12.02.2018 / 12:59

1 answer

0

The problem was in the database. Although there is no error in visual studio the problem is that it did not have the updated template with the database.

    
05.03.2018 / 13:18