Questions tagged as 'linq'

2
answers

Problems with types and conversions when filling a page

This is the error: An exception of type 'System.InvalidCastException' occurred in App_Web_fjskumyk.dll but was not handled in user code Additional information: Não é possível converter um objeto do tipo 'System.Collections.Generic.List'1[<...
asked by 23.09.2014 / 15:55
1
answer

Linq returns result, but does not obey join

We're getting close. With that code, it almost worked. Then I changed the % from% to Distinct() and did not repeat, but still does not obey the DistinctBy() . What comes in linq does not match query . In all Reasons I brough...
asked by 24.09.2014 / 13:06
1
answer

How do I put a count in a linq that returns a list

I need to make a count , for the following situation. See the image below, which I have repeated some pharmacies, see their CNPJ (06626253003681 and 06626253001476 ). They are repeated because they are on different dates. What I need is t...
asked by 24.09.2014 / 20:43
1
answer

How to receive unique data in asp net mvc

I have the following model called Conta : public int Codigo { get; set; } public string Nome { get; set; } public int Prazo { get; set; } Assuming I want to do a select (without using lambda) and just bring the Name property, in this...
asked by 04.07.2014 / 15:42
2
answers

When concatenating in LINQ I get error

I made this LINQ. In the concatenation between DDD and phone number, which I call phone1, it is flicking. var agendamento = ( from pdv in db.T_PDV from tarefa in db.T_TarefaParceiro.Where(trf => trf.CNPJ == pdv.CNPJ).DefaultIfEmpt...
asked by 16.06.2014 / 20:54
1
answer

Doubt about insert in bank with foreign key using linq

I have a question, how to insert data into a mysql table, using linq, I have the tables below: I'm using the method below to insert: public void inserirCarteira(float cpf, string codigo, double valor, int quant, double vtotal) {...
asked by 11.06.2014 / 04:12
1
answer

Get day of week through a date LINQ

I need to get a record set of a weekday (Second Example), where for this I have a field in the table of type datetime. In Sql it would look something like this: SELECT AVG(P.Quant) AS Expr1 FROM P WHERE (Pro.Tipo = 'B') AND (V.ID= 1) A...
asked by 02.04.2014 / 19:22
1
answer

Help with LinQ Method using group by Dynamic

I need to build a dynamic chart from a filter panel and two select fields that can be crossed. I already have the structure that goes to the graph and how I need to return from the backend . In the case of backend I have the code below t...
asked by 14.11.2018 / 20:10
0
answers

Query on table name by Reflection

I'm trying to make a query in the table, that its name will come by method scope, but it does not allow me to use Select(); or Where(); System.Type referenceTableType = System.Type.GetType("MeuProjeto.Model." + typeRequest.Refer...
asked by 17.09.2018 / 14:27
2
answers

LINQ (LAMBDA) How do I add another list of objects and add them to my where? W#

Good afternoon, I'm doing an application in C # .Net Core, using lambda for database context handling. I have one question, which is as follows: I have a list of objects with these two attributes: Name and StartDate. Something like: List<Op...
asked by 02.07.2018 / 18:58