Questions tagged as 'linq-to-sql'

3
answers

What is the most correct way to query with LINQ?

I'm trying to make a LINQ query on my DB SQL Server, but its result always comes 'null'. I need the first userid on which I query. This is the way I try to query it: public decimal GetCustomerBalance(long accountCurrentAdvisorId) {...
asked by 11.04.2015 / 05:46
2
answers

Selecting a value from a row / column of the ListView 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 row / column value from this ListView, after the double-click event, this informati...
asked by 23.01.2016 / 21:43
2
answers

Error in .First (), because there is no result selected

In my controller login I use the following code to make the user selection if it exists, however whenever the user types the incorrect name or password, an error because it does not find the result for .First . I need to make a treatmen...
asked by 04.12.2015 / 20:25
1
answer

How do I get the CommandText of an IQueryable?

I'm trying to get the sql generated by IQueryable , but it's returning: SELECT NULL AS [EMPTY] I expected something like: SELECT i FROM lista WHERE i > 20; How I'm doing: IDbConnection conn = new MySqlConnection("serv...
asked by 10.11.2017 / 14:10
1
answer

Show 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 avisos = (from av in neEAD.mot_avis...
asked by 17.05.2016 / 21:35
1
answer

How to Popular a Listview, and Popular Another Listview by Primary Key?

I have two ListViews that I need to use LINQ to SQL (C #, WPF project) in a search field. When typing in the textbox field the KeyDown event will populate the first ListView (1), as the second has a column that is the Primary Key of the first, I...
asked by 25.06.2016 / 22:14
1
answer

Converting a SQL from Sql Server to LINQ from C #

I have an sql that looks something 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 ('a', 'b', 'c...
asked by 18.12.2014 / 14:41
2
answers

Linq, Join by comparing with Like

I have a question regarding Linq. As I have observed some codes, they usually use for example: var _s = (from p in exemplo1 join q in exemplo2 on p.blabla equals q.blablabla I would like to know if a structure like for example t...
asked by 10.03.2016 / 18:25
1
answer

LINQ to SQL InheritanceMappingAttribute property Code

What is the purpose of the Code property of the InheritanceMappingAttribute attribute? The documentation describes this way:    This property holds a value that appears in the database table in the% col% of column to indicate...
asked by 22.04.2016 / 16:46
0
answers

doubt conditions from Linq to Sql [closed]

I have a GridView with certain products and a Quantity DropDown for each. In an event onClick , the products with quantity > 0. The problem is when I have a table "order details", and I invoke it with Linq to SQL. My goal was to comp...
asked by 23.10.2014 / 19:51