Most voted "linq-to-sql" questions
Language-Integrated Query for Relational Data (Integrated query language for relational data)
Learn more…39 questions
Sort by count of
-
11
votes3
answers175
viewsWhat is the most correct way to make a query with LINQ?
I am trying to make a LINQ query in my BD SQL Server, but the result of it always comes 'null'. I need the first user ID I query. This is the way I try to consult: public decimal…
-
7
votes2
answers2252
viewsSelecting a value from a Listview row/column populated by LINQ to SQL
Through the double click event I need to pull a value from a row/column in a Listvview populated by LINQ to SQL. For example, when the user needs to select a value from a row/column of this…
-
4
votes1
answer108
viewsError in . First(), as there is no selected result
In my controller of Login I use the following code to select the user if it exists, but whenever the user type the incorrect name or password, it gives an error, because it does not find the result…
-
4
votes1
answer320
viewsHow to get the Commandtext from a Iqueryable?
I’m trying to catch the sql generated by IQueryable, but is returning: SELECT NULL AS [EMPTY] I expected something like: SELECT i FROM lista WHERE i > 20; Like I’m doing: IDbConnection conn = new…
-
4
votes1
answer578
viewsHow to generate a subquery in Line/EF
Hello, everybody. I have a situation, where I concatenate some subquerys Sqls that are concatenated into other Sqls queries, to return some values. I have several functions like these, because I use…
sql-server entity-framework linq linq-to-entities linq-to-sqlasked 5 years, 10 months ago Fabiano Richetti 41 -
3
votes0
answers63
viewsdoubt Linq to Sql conditions
I have a Gridview with certain products and a dropdown of quantity for each. At an event onClick, products with quantity > 0. The problem is when I have a "detailed" table, and I invoke it with…
-
3
votes1
answer103
viewsConverting an SQL from Sql Server to C#LINQ
I have an sql that looks like this: SELECT coluna1, coluna2, coluna3 FROM ( SELECT coluna1, coluna2, coluna3, ROW_NUMBER() OVER(ORDER BY coluna1, coluna3 desc) as row FROM tabela1 WHERE coluna4 in…
-
3
votes1
answer96
viewsLINQ to SQL Inheritancemappingattribute Code property
What is the purpose of the property Code of the attribute InheritanceMappingAttribute? The documentation describes this way: This Property Holds a value that appears in the database table in the…
-
3
votes1
answer100
viewsShow data from multiple models in the view
I have the following problem: In a view I will show data from 8 different tables and I have the following code that I put together to take the data to the view. public ActionResult Index() { var…
-
3
votes1
answer349
viewsHow Popular a Listview, and her Popular another Listview by Primary Key?
I have two Listviews that I need popular using LINQ to SQL (C#, WPF project) from a search field. When typing in the field(textbox) the Keydown event will popular the first Listview (1), as the…
-
2
votes2
answers146
viewsMapping a List<long> 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, only I came across a situation that I couldn’t find any example of similar situation to try to solve,…
entity-framework linq windows-phone orm linq-to-sqlasked 10 years, 2 months ago Fernando Leal 9,770 -
2
votes1
answer167
viewsHow to search for the record when the table has a composite primary key?
I have in my database the table t_command_control. This table has a composite primary key formed by the fields CD_STATION and CD_COMMAND. If the primary key was simple (only as a field CD_STATION) i…
-
2
votes1
answer601
viewsHow to transform Amble expressions into sql commands?
How can I manipulate expressions to help automate the creation of SQL commands like Linq to SQL? So: using Entityframework I can make queries such as: var livros = contexto.Livros .Where(livro =>…
-
2
votes3
answers756
viewsLinq, doing Join comparing to Like
I have a question regarding Linq. As I have observed some codes, they usually use as an example: var _s = (from p in exemplo1 join q in exemplo2 on p.blabla equals q.blablabla I would like to know…
-
2
votes1
answer78
viewsSelecting Suppliers by Fancy Name
I have a PRODUCT registration form and there is a relationship with the SUPPLIER table, as shown in the image below: Which click on the SEARCH VENDOR button will appear this View Now I need to…
-
2
votes1
answer183
viewsLINQ to SQL with entities that already exist, inheritance and composition
I’m starting to study LINQ to try to implement a project I’m working on. For examples both in articles as in videos, LINQ has an interface in visual Studio that generates the entity classes from the…
c# inheritance abstract-classes linq-to-sql compositionasked 8 years, 8 months ago Matheus Saraiva 2,157 -
2
votes2
answers293
viewsUsing Linq to sql, how do I get the generated sql query?
Hello. If I have an example: var agendamento = _repository.First(a => a.iid == id && a.locIid == _usuario.LocalidadeContextoId && a.activeVersion == 0, "", true); I can see the…
-
2
votes1
answer3085
viewsGrab a list from the View and move to the controller c#
I have 2 lists that come from the database, one from technical and another from suppliers. I’m not able to take the View and pass to the Controller. And how to receive this list in the controller…
-
2
votes2
answers82
viewsFilling Label with Linq using Tolist()?
I have a table with the following schematics: GarantiaImovel | imovelID | GarantiasTipos 12 | 3 | Caução2 12 | 4 | Depósito 12 | 5 | Caução2 12 | 5 | Fiador 12 | 5 | Seguro Fiança So I have the…
-
2
votes1
answer405
viewsBring a newly added ID to put in a textbox c# windows form
I request a help to do the following, I do an Insert via Procedure after saving I want to fill the textbox with the id created so I can use it to associate to my item I just need the order code to…
-
2
votes2
answers123
viewsHelp with LINQ, query no . Net
Good morning, guys, I could use a little help with LINQ. I am trying to perform the following query through the: SELECT NFE_SAIDA.NFESAI_SEQUENCIA FROM CAD_NFE_SAIDA NFE_SAIDA LEFT JOIN…
-
1
votes1
answer159
viewsLinq function does not return List
Hello, I have an application and it does not return a list I select via Linq-to-Sql The error may be in the SELECT that Linq-to-sql is doing. SELECT [Extent1].[Codigo] AS [Codigo],…
-
1
votes0
answers154
viewsQuery using Firebird "SUBSTR" with Inline, QueryOver, Criteria
Guys, I need to create a query using the "SUBSTR" function of Firebird with Line, queryOver or Criteria. I have option to create with HQL or SQL, but these would be my last options. Anyone have an…
-
1
votes0
answers333
viewsList with repeated records via Linq
I am trying to perform a simple query with LINQ, and the code below is returning me repeated records in the first 5 lines of the list. var teste = (from p in db.VW_PAGAMENTO_RECEBIDO where…
-
1
votes1
answer92
viewsLinq to SQL - Dynamic sort by column index
I’m using a component called datatables.js (https://www.datatables.net/) to display my tables and it owns the property Serverside, that I call, in Ajax, my list from somewhere. It sends the…
-
1
votes0
answers26
viewsHow to implement the "Where" clause as "in" and "not in" in c# Linq?
I have the following querys: Select * from Processos where idProcesso in (1,2,3,4,5); Select * from Processos where idProcesso not in (1,2,3,4,5); Where idProcess is a column with data type int. I…
-
1
votes2
answers78
viewsConvert SQL to LINQ C#
how do I convert the last line of this SQL to LINQ? SELECT* FROM ACOMPANHAMENTO A, PRESOS_ACOMPANHAMENTO PA, PRESOSS P WHERE P.ID_PRESOS = 300 AND PA.ID_PRESOS = P.ID_PRESOS AND A.ID_Acomp =…
-
1
votes1
answer170
viewsLinq to sql with subquery
I have two tables, and would like to get only the data from table A, filtering by related table B. I would like to know how to write this query with Linq to Sql in C#. I wrote the example below in…
-
1
votes2
answers209
viewsAdd subitems between groups with Linnus
How can I perform calculations between subsets of a group by query in English? Follow example: Consulta Linq var listPlanoDeContas = (from t in _planoDeContasRepository.GetAll() orderby t.Month…
-
0
votes1
answer221
viewsInstruction Left Join in LINQ to entites
I tried to do a left Join on LINQ as follows: (from opr in db.Operacao join vol in db.Volume on new { VOL_CODBAR = opr.OPR_CODBAR } equals new { VOL_CODBAR = vol.VOL_CODBAR } into vol_join from vol…
-
0
votes2
answers379
viewsListview with an empty and editable column
People wanted to have empty and editable cells in a column of a Listview that pulls from the SQL Server Database information to my project. To pull the information I use LINQ and I can list all the…
-
0
votes0
answers22
viewsGridview and Linq to SQL
I am trying to change data in a Gridview using a Datasource Linq to SQL Context: I created a table in SQL: Bancoid int Autoincrement Banconumero char(3) Banconome varchar(30) I created a Linq to SQL…
-
0
votes1
answer478
viewsExport Listview to Excel (.xls) from a list populated by LINQ, WPF project (C#)?
Good... I need to export the Listview data populated by the LINQ method of an SQL database... I’m not getting the Column Headers in Excel... Anyone can help? Reference:…
-
0
votes1
answer415
viewsUsing Elements like "Not Exists" and Sub Query in LINQ, LAMBDA EXPRESSION and Nhibernate
Good Morning, I have a query to be executed in my database, however, here in our projects we use Nhibernate as a ORM tool. I’m having difficulty passing this SQL query to a syntax used with…
linq lambda-expressions nhibernate fluent-nhibernate linq-to-sqlasked 6 years, 3 months ago Italo Angelo 3 -
0
votes1
answer17
viewsI need to get the value of Navigation Properties
Friends, how do I show in my View information through a navigation property, like: My View: <div class="panel-body"> <div class="table-responsive"> <table class="table table-striped…
-
0
votes0
answers39
viewsC# - Comparison of date with LINQ does not bring the expected result
We have an Oracle database with a View. We have to take the total harvested cane by adding the column QT_LIQUIDO according to the day. We made the code in C#, but it is with an unexpected behavior.…
-
-1
votes1
answer488
viewsHow to perform a Left Join with LINQ C# using my SQL?
Example that works in SQL: select * from Doacoes inner join Projetos on Projetos.IdProjeto = Doacoes.IdProjeto left join Pedidos on Doacoes.IdDoacao = Pedidos.IdDoacao left join Recompensas on…
-
-1
votes2
answers94
viewsdoubt with Linq to sql
Guys, I got two tables, sale and blindfolds: Sale: [Table("venda")] public class VendaModel { [Key] [Required] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int id_venda { get; set; }…
-
-2
votes1
answer39
viewsOrder By Doubt with LINQ to generate report
I’m making a report with the iTextSharp and I order by date but when I view the report the company Empresa2XYZ appears 2 times with the same date. Follow the code with LINQ. lista =…