All Questions
706
questions
0
votes
0
answers
37
views
Group collections into unique sets
I have data in which needs sorting into individual sets based on having unique id's per set.
For instance I am starting with the below (its actually a pending sql query, but making up the below as an ...
0
votes
1
answer
453
views
LINQ to SQL Foreign Key Restraint
In this code, I have an insert button that will take in the user's input from the textbox and store it in the database. I know the code works as intended with the other tables that have no Foreign ...
0
votes
1
answer
341
views
LINQ - Nested WHERE IN query
I have the following SQL query and I want to convert it to LINQ expression.
SELECT `a`.*
FROM `action` AS `a`
WHERE `a`.`id` IN (
SELECT MAX(`a1`.`id`) AS id
FROM `action` AS `a1`
GROUP BY ...
0
votes
1
answer
136
views
Updating record not working in LINQ to SQL with primary key set in class
I have code which should update ma database:
public static void UPDATEroz(DataClasses1DataContext dc, string nazwavar)
{
var update = (from p in dc.dataTable
where p.nazwa....
-1
votes
1
answer
649
views
LINQ Equivalent of "select *, count()"
I have two table A , B on SQL Server like bellow:
Columns of A: id1, id2, col_1, ... , col_100
Columns of B: id1, id2, ... (some columns)
I want to write the equivalent of below SQL query in the C# ...
0
votes
0
answers
62
views
Convert and optimize c# linq to sql code by join
I have some code in c# linq and want to convert it to join(optimize speed).
exp:
1- first it gets 2 param (a.fromDate b.toDate)
2- for each date wanna load all pathCodes(table)
3- for each (date-paths)...
0
votes
1
answer
450
views
Find entities not in many-to-many relation
I might be looking at this the wrong way but I have a basic many-to-many code-first setup in EF Core 3.1 with Department <-> DepartmentDay <-> Day.
modelBuilder.Entity<DepartmentDay>(...
1
vote
2
answers
64
views
How to write a linq query for below Scenerio [closed]
I am trying to write the convert the SQL query to Linq but I am not sure if there is a way to write this query. Also, This query grab only matching value from CartonDetails table but i need all the ...
0
votes
3
answers
61
views
How do I do an inner select in linq?
I have a database table called Customers. I run the following sql to get information about the first and second customer:
select FirstCustomerName, SecondCustomerName,
* from Customers where ...
0
votes
2
answers
1k
views
How to set inner join in linq query
I want to set inner join in linq query
Here is my code,
var JoinUsingMS = from emp in _productRepository.Table
join address in _purchaseReminderRepository.Table
on new { c1 = emp.VendorId, c2 = ...
0
votes
2
answers
439
views
C# Convert SQL query with Case statement to LINQ
I added a new column in one of my table and the result of this column depends on the result of 2 other columns. I did a update so I can fill the existing rows with information but I would also like to ...
0
votes
2
answers
105
views
How to use Linq to query a table dependent on where a user belongs to another table
I have a simple issue that's running me around, I would like to find out how I can use linq to query a subset of data, e.g. I have a table that contains certificates, certificates belong to a company ...
2
votes
1
answer
144
views
SQLITE: Return 5 most recent records today and format date/time
I have a Xamarin.Forms app which has a ListView. I would like to populate the ListView with the 5 most recent items where the date is today's date. If there are less than 5 items, the ListView should ...
0
votes
3
answers
2k
views
Check ISNULL for boolean value in LINQ query
How can I convert this SQL statement in LINQ query?
ISNULL(IsBlocked,0) = 0
IsBlocked is a column in the table Persons.
1
vote
1
answer
44
views
Incorrect results from multiple joins in Linq2SQL
I've been tasked with converting some crusty old SQL to Linq2SQL and I know this shouldnt be the first choice however it needs to be done.
Problem
I'm stuck attempting to force specific joins to ...