Questions tagged as 'linq'

1
answer

How do I search for the record when the table has composite primary key?

I have in my database the table t_command_control . This table has a composite primary key formed by the CD_STATION and CD_COMMAND fields. If the primary key was simple (just as CD_STATION field) I would use the...
asked by 30.11.2014 / 18:50
2
answers

Expression yields no result, but there is data

This is my query in direct sql. select c.de_cnpj, c.DT_TransacaoV from T_CRM_StatusPDV c join T_PDV p on c.DE_CNPJ = p.CNPJ where DATEDIFF(DAY,c.DT_TransacaoV,GETDATE()) > 45 This is my lambda expression, which in my view corresponds to...
asked by 06.06.2014 / 22:13
1
answer

Error in query linq

I'm trying to query the table below from my database. Thisqueryisperformedusingthemethodbelow:public void compraAcoes(float cepf, string codigo, int quantidade) { string cd = codigo; try { float cpf; BuscaNet bus...
asked by 01.06.2014 / 22:02
1
answer

What is most advisable? Do you query through a list or directly in the database?

I have to perform a query where I need to do 4 INNER JOIN and still use WHERE in several fields. What is most advisable? Conduct the query in this way? using (DbContexto db = new DbContexto()) { var query = (from t1 i...
asked by 19.11.2014 / 17:51
2
answers

Mapping a Listlong in LINQ to SQL - Windows Phone 7.1

Problem I'm starting an application for Windows Phone 7.1, and I'm implementing the database, but I came across a situation that I did not find any similar situation to try to solve, and I also did not find anything to help me with the docu...
asked by 17.10.2014 / 04:38
1
answer

Error when simulating distinc in query with Linq and lambda expression

I have 2 tables in a SqlServer database. One call to another and another. I'm trying to return all states of the tbState table that have at least one city (tbCity) and with the properties tbCity.bnlActivityCity and tbCity.blnExibirNoPortal = tru...
asked by 10.01.2018 / 18:34
1
answer

A problem to solve with lambdas expressions

I did this to return a list. It happens that it gives error, saying that it has no way to transform an anonymous expression in the past type (object). public List<Liberacao> PegaLiberacao() { var lista = contexto.Libe...
asked by 22.08.2017 / 00:59
1
answer

How to get the contents of a tag through a Linq query?

I have XML with the following structure: <?xml version="1.0" encoding="UTF-8"?> <pessoas> <pessoa> <nome>Joao</nome> <email>[email protected]</email> </pessoa> <...
asked by 02.07.2016 / 17:27
1
answer

LINQ TO XML Query with Optional Element

Hello everyone, I am having a question about displaying the data from an XML file through a LINQ query , the problem is that I am trying to query the person's data but the and then the NullReferenceException and Endereço and NullReference...
asked by 30.10.2015 / 19:32
1
answer

LEFT Outer Join does not work in LINQ when 0 is the reference? only null

I'm having doubts on Left Outer Join, I'm using MVC 5 C #, Net 4.5.2. I have the Next Model Supplier public class fechamentoFornecedor { public int FornecedorId { get; set; } public int Tipo { get; set; } publ...
asked by 26.02.2016 / 15:09