Questions tagged as 'linq'

0
answers

Error in Linq query

I have a DropDownList with which I want to bring the records according to the item selected, when I click on the search button I get the following error:    The entity or complex type 'DB_ALMACENModel.Product' can not be   const...
asked by 18.07.2018 / 06:10
1
answer

linq query on 2 group by lists

I have the following query in linq, which takes 2 lists as a data source. The first contains a list of IdProducto and its description public class Productos { public List<Producto> lstProductos { get; set; } } public class Pro...
asked by 24.06.2018 / 22:47
0
answers

Linq query. Orderby [closed]

Good day, I am starting to use linq and when I execute my query. This takes up to 1 hour. Does anyone know how I can optimize it? if (db.GpsInfo.Any(i => i.device_id == id)) { var gpsinf = db.GpsInfo...
asked by 14.06.2018 / 18:08
1
answer

Problem C # winforms LinQ

I am working CodeFirst and I have the following table in my DB and when I want to show it the query in a DataGridView brings all fields, but I want to show only 2, exactly the name and the price. What should I modify in the Linq query? var pro...
asked by 20.06.2018 / 18:30
0
answers

How can I enter data from a DataGridView to an SQL table through Linq?

I have to fill a table with the data from a DataGridView but I can not do it, I pass the data to a first DataGriView. All this with LINQ After filling the first DataGriView I want the "Save Week" button to save the data in SQQL and show...
asked by 12.05.2018 / 19:27
1
answer

how to show a list with a master structure-detail MVC

You want to show all the details of a certain project, for this you have the following tables in the Outputs table the headers (projects) are saved and in the table Outputs Details are saved (list of products of different projects) T...
asked by 19.03.2018 / 20:13
2
answers

List records with the most recent date

I have the following List<Pago> listaPago = dbc.pagos .GroupBy(c => c.codigoUsuario) .SelectMany(w => w) .OrderByDescending(f => f.fechaPago) .ToList(); And it shows me the following codigoPago codigoUsua...
asked by 24.11.2017 / 21:53
0
answers

LINQ: Query GROUP BY conditional COUNT

How is it possible to move this type of operation to Linq ... in SQL:    COUNT (CASE WHEN VALUE="EXAMPLE" then 1 else = 0 END) Within a GROUP BY statement In linq? from join... from... group new { contador = tabla.Count(x=...
asked by 22.06.2017 / 14:19
1
answer

Paginate the result of a query with Linq

I am working with Entity Framework version 6 together with SQL Server localdb 13.0.2151. I have 4 entities Professors, Resources, Subjects and Assignments. The query I intend to make must retrieve all Assignments along with their Resour...
asked by 06.12.2016 / 17:48
1
answer

I can not update the data source in VS

 I have a project in visual studio professional 2012 where I use the linq when I add a field to the database (in SQLServer) in the linq the new field appears in the image that I added I have the field cuenta_sobrante but it does not up...
asked by 01.11.2016 / 23:45