Questions tagged as 'linq'

2
answers

how to call stored procedure with linq

Good morning everyone. I have stored procedure in sql server and I would like to call it in my c# application, via linq . Thanks in advance for any help     
asked by 16.09.2016 / 12:29
1
answer

Format query in linq to send to the ViewBag

I made a query in linq, but the result was not expected, it seems the problem is simple but I can not solve it. Result on label:    {Year = 2016/2017} Expected result on label:    2016/2017 Controller: //query var queryAn...
asked by 10.03.2016 / 20:44
1
answer

Query too slow to export in excel

I have created a method to export some columns to xls and the process is very slow, it takes almost one minute to do the whole process. public void Download(string datainicio, string datafinal, int? searchContrato, string searchCliente, st...
asked by 21.03.2018 / 13:22
1
answer

Return missing date x days to arrive

Scenario: Ciclos id name endDate (datetime?) Data: 1, primeiro, 05/10/2017 2, segundo, 15/10/2017 3, terceiro, 20/10/2017 4, quarto, 30/10/2017 With linq and lambda, I would like to return dates that are above the current date, but ar...
asked by 11.05.2017 / 22:35
2
answers

apply filter on return from a list

I'm doing an query where I have a array of situations ex: 1, 2, 3 in the query I have to filter for these situations, follow my code. var array = GetSituacoes(); var lista = bll.Query(p => p.Contrato.PessoaFisica.ID == SessionControl.Pess...
asked by 17.05.2017 / 16:34
1
answer

Return a new object using the ForEach function

Have the following list List<EmployeeTotal> totals = Context.Database.SqlQuery<EmployeeTotal>(query).ToList(); I want to transform all objects from the totals list into a new type list        List<EmployeeTotalA...
asked by 13.06.2017 / 18:26
2
answers

How to make a datagridview C # sort a list (IList) with click on the grid header? [closed]

How to make a DataGridView C # sort a list (IList) with click on the grid header? For example, I have a list with three fields (id, name, city), when the user clicks on the name column, I want to sort by Name, if I click on the city I want...
asked by 02.01.2017 / 20:49
1
answer

Get different records in two tables

I have a offline table: id int descricao string online int chave string And another table online : id int descricao string chave string How do I select the fields of the online table that do not exist in the offl...
asked by 02.03.2017 / 15:00
1
answer

Select in Entity Framework is not working

I am doing a query using LINQ, very simple query I am using the following method. public void verificaAcesso( string usuario, string senha) { using (DbBancoContext banco = new DbBancoContext()) { var resultadoConsulta = from u...
asked by 10.10.2014 / 18:52
2
answers

Doubt on how to select a record via linq

I have a table, where I only write scripts . There is a field, where I separate whether it is technical script or central script. There is a TipoScript field that char is "C" or "T". This table was not well done without thinking about th...
asked by 21.05.2014 / 20:43