-3
I have a table of events. And each POS, an event is held, with the Event ID, Date, User and Type. Well, whenever I make a query, I populate an event grid. I would like to know, how to bring the last five with LINQ and/or Lambda, to the same CNPJ?
Is that code correct?
var result_evento = (from ev in db.T_CRM_Evento
select new { ev.ID_CRM_Evento, ev.DE_Usuario, ev.ID_TipoEvento, ev.DT_Inclusao})
.Take(5)
.Max(evento => evento.DT_Inclusao);
This one worked. It messed with my layout, but it worked. At least in terms of bank result, it worked.
var result_evento = (from ev in db.T_CRM_Evento
.Where(e => e.DE_CNPJ == carregagrid.Cnpj)
select new { ev.ID_CRM_Evento, ev.DE_Usuario, ev.ID_TipoEvento, ev.DT_Inclusao })
.Take(5)
.OrderByDescending(dt => dt.DT_Inclusao);
Where is the CNPJ parameter?
– Leonel Sanches da Silva