Skip to main content

All Questions

Tagged with
0 votes
0 answers
28 views

Use some kind of helper function In EF Select query to make subquery [duplicate]

I have several tables that handles different kinds of translations for my entities and those tables to linked via relations to other entities. I use subquery to directly access translations tables ...
user3408420's user avatar
1 vote
2 answers
120 views

Multiple tables query with repository pattern

I have an ASP.NET Web API project, and have implemented repository and unitOfWork patterns. I currently have a big SQL query that I want to implement in code, it includes a lot of tables and joins. My ...
RifloSnake's user avatar
1 vote
1 answer
56 views

Join tables based on StartsWith function

I have two tables to join. The joining condition is a column that should be like or starts with the other column, not exactly equal. How to do that in Linq? This is my function: public async Task<...
sara's user avatar
  • 135
-5 votes
0 answers
79 views

EF Core comparing DateTime performance. SQL CONVERT(Date) vs SQL DATEPART

I have a DateTime column called TimeStamp in my database table. It is indexed. Which of the queries below gives me a better performance? QueryA or QueryB? var dateOnly = new DateOnly(2024, 01, 01); ...
JeeShen Lee's user avatar
  • 3,646
0 votes
0 answers
92 views

HOW to generate SQL TRANSFORM, INNER JOIN and GROUP BY with database MS ACCESS IN VB.NET

I'm trying to generate SQL TRANSFORM, INNER JOIN and GROUP BY with database MS ACCESS in VB.NET. I don't want to use functions in MS Access because I use SQL for VB.NET. Is there any other method? ...
Tam88's user avatar
  • 71
0 votes
2 answers
66 views

How do I do an inner GroupJoin on dotnet?

I'm using .NET 6 with Entity Framework. This is my situation: I have a BenefitEntity (with Name and Description properties and a relationship with BenefitCategory) and this BenefitCategory which has ...
Raso's user avatar
  • 61
1 vote
1 answer
51 views

Group by, count distinct SQL query to IQueryable using Linq

I am trying to translate the following SQL into IQueryable, so I can access the result and filter on different conditions, before the data is retrieved from the database, but I get an error that the ...
Max's user avatar
  • 93
2 votes
2 answers
108 views

how to query based on start and end period dates with MS ACCESS in VB.NET

I'M trying to query based on start and end period dates with MS ACCESS in VB.NET Table ABSEN can union with table HELPERABSEN so I want to take the start date and end date from the table PERIOD with ...
Tam88's user avatar
  • 71
-1 votes
2 answers
112 views

Query (or LINQ in Entity Framework) for getting user's rank

I have a SQL Server database with a table named Users. This table has 2 columns: XP (int32) and Name (nvarchar). I need a SQL query or Linq (this is better because I'm using Entity Framework in C#) ...
Yasim Yasin's user avatar
0 votes
0 answers
54 views

LINQ query much slower than SQL equivalent

I've written a linq query, which when I grab the T-SQL from profiler and check stats, is very bad. The execution plan is also so complicated as to be unreadable. The same query converted to SQL, is ...
BMills's user avatar
  • 911
0 votes
1 answer
32 views

SQL to Linq conversion with SYSDATETIMEOFFSET

Could someone assist me in converting following sql query to LINQ? Important part of this one is to be able to convert the date to a UTC date (with daylight savings). SELECT a.id, b.id FROM ...
saif's user avatar
  • 400
0 votes
2 answers
97 views

What should we do If we have Or condition in INNER JOIN with EF Linq?

I the code below I have a TSql query which has Or condition in its join. If I want to convert it to Linq in C# how can I rewrite it. SELECT P.Id AS ProductId FROM generalinv....
Sasan's user avatar
  • 614
1 vote
0 answers
142 views

Converting SQL ROW_NUMBER to Linq produces wrong translation

I have the following SQL code and I want to convert it to a LINQ query in Entity Framework Core 8. SELECT * FROM( SELECT ROW_NUMBER() OVER (PARTITION BY StaffId,[Location] ORDER BY [Timestamp] ...
derodevil's user avatar
  • 1,007
0 votes
0 answers
48 views

Data Context is error when adding in ASP.Net

I'm not sure if this is the right section to post so please whoever it may be, don't be angry with me as I'm desperate and stuck I received this error message when loading my application. I am using ...
Victor Hernando's user avatar
0 votes
0 answers
51 views

Optimizing the process of joining multiple tables in SQL using LINQ

There are five tables to join. I have successfully joined them together, but I believe there is room for optimization. Initially, I had to apply a 'group by' operation on the 'comments' table and then ...
Ali.M Eghbaldar's user avatar

15 30 50 per page
1
2 3 4 5
386