Questions tagged as 'linq'

1
answer

The entity or complex type 'DBModel.User' can not be built in to LINQ to Entities query

var result = db.Users.Select(x => new User() {CommpleteName=x.CommpleteName}).FirstOrDefault(); I am trying to select a column from my user table and I receive this error:    The entity or complex type 'DBModel.User' can not be construct...
asked by 05.07.2016 / 11:59
1
answer

query from transact sql to linq

I have a query in Transact SQL , and I need to modify it to LinQ for a migration of a program I'm doing, but I've had problems specifically with a function of SQL Server , the datediff , with which It has been difficult...
asked by 03.08.2016 / 21:14
2
answers

Sorting of lists C #

I have a question about the handling of lists ordered in C # I basically have a list like the following 1/02/2018 Capital $800 1/02/2018 Interes $1000 1/02/2018 IVA $160 1/03/2018 Capital $800 1/03/2018...
asked by 09.03.2018 / 23:40
1
answer

Linq - Consultation in the third level list

I have a list of a class (A) that contains a list of another class (B) and that in turn contains another list of another class (C). I need to filter the initial list (A) from the value of a property of the class (C). The example would be somethi...
asked by 08.06.2017 / 12:43
1
answer

How to group multiple columns and count records with LINQ from a CSV file in C #

I have a problem grouping several columns and counting your records in each column by reading it from a CSV file, Example CSV records: Nombre,Apellido,FechaDeRegistro,Aceptado David,tod,09/09/2014,SI David,lopez,09/09/2011,NO David,cortez,09/0...
asked by 07.12.2016 / 16:31
2
answers

Convert sql query to linq

I have basic concepts of linq, but I stuck with a query with group by someone could help me translate this query from sql to linq: select at1,at2,count(1) from tabla where fecha=trunc(sysdate) group by at1,at2 Greetings.     
asked by 12.08.2016 / 22:26
2
answers

How to Convert ICollectiont1 in ICollectiont2

I have a LinQ To Entities Query, And an ActivityModel returns to me, but it really does the query to the Activity entity, and I assign each data as you can see it, but it brings me the Orders as Icollection<Orden> , and in Activit...
asked by 25.10.2016 / 23:57
1
answer

Add columns with linq

I need to add several columns and return them in a list. But in two columns I will add adding a condition. SQL SELECT SUM(MontoInicial)AS MontoInicial, SUM(CASE WHEN TipoMovimiento = 1 THEN Ingreso END) AS Ingreso, SUM(CASE WHEN TipoMovim...
asked by 19.12.2018 / 23:28
5
answers

Make a query with LINQ to entities

var query_actualizar = from x in ctx.banner let orden = ctx.banner.Where(y.id_banner == id_banner).First(y=> y.orden) where x.orden > orden select x; foreach (banner ord in query_actualizar) { ord.orden = ord.ord...
asked by 19.12.2016 / 15:27
2
answers

Select with LINQ

I need to recover the code of a division which is a string and return it to show later. The code I have is the following but there is something that does not work and I do not know what it is. Any suggestions? public string DivisionCode()...
asked by 07.06.2018 / 21:56