Skip to main content

All Questions

Tagged with
0 votes
0 answers
59 views

How do I set SQL Provider in C# Linq

I changed the default collation of my SQL Server 2022 database (and all string objects that already existed) to Latin1_General_100_CI_AS_SC_UTF8. Unfortunately, Linq seems unable to handle this ...
awba's user avatar
  • 1
0 votes
0 answers
92 views

Dynamic LINQ sorting after grouping

We wrote a generic filterable repository in .NET 8 that should be able to accept a list of filters and a list of sorts, and apply them to any given entity. Due to some business logic, we have a Task ...
Predrag Despotovic's user avatar
1 vote
0 answers
37 views

Linq to SQL - SQL join statement with specific return [duplicate]

I have the following table entity with my sql-database : using System.Data.Linq.Mapping; [Table(Name = "Users")] class Users { [Column(Name="UserKey", IsPrimaryKey=true)] ...
David's user avatar
  • 11
0 votes
2 answers
75 views

DataContext always ReadOnly, even though a primary key exists

I'm attempting to update a value in my Database, but the IsReadOnly property is always coming back as True. According to Microsoft, that property Gets a value that indicates whether the type of the ...
Alpocalypse's user avatar
0 votes
0 answers
37 views

ExecuteCommand in data linq query

I use ExecuteCommand in data context in linq to pass update command like this _context.ExecuteCommand("update tb_ExpList set exp_name = '" & TextBox8.Text & "',exp_desc = '"...
ABDULAZIZ DHAW's user avatar
-1 votes
1 answer
34 views

How to bind different values from a list into another list on the bases of Key using Linq

I am working on application where I am receiving data shown in demo list below. var dd = new List<ConfigurationItem> { new ConfigurationItem { Key = "Partners:JohnDeere:...
Muhammad Kamran's user avatar
0 votes
1 answer
40 views

Linq to SQL calculate average and count with a join

I am trying to calculate the average rating for a product category and the total number of ratings received. In the example below, I would like to get the average rating/count for the shirts category....
Brian Salta's user avatar
  • 1,576
0 votes
1 answer
245 views

Convert from LinqToSQL to Linq2DB

I have a project where an existing SQL Linq connection and full DBML has been created. Now I need to convert this same code to access from MySQL (Don't ask why... it's complicated). I have install ...
Geoff's user avatar
  • 373
-1 votes
1 answer
317 views

How to concatenate a date and a time string and compare with a DateTime using LINQ

I have two strings, one of them for time only and the other for the date. I compare the concatenation with a DateTime. I want to translate this SQl query to LINQ: select count(*) from ViewAllTranUser ...
Mohamed Fouad's user avatar
0 votes
1 answer
288 views

Linq join using split in condition

I'm a newcomer in Linq C#. I have a scenario where I need to check part of a sentence is equal to another value of the field. I use IndexOf to get part of the sentence in the left join condition. The ...
Amelia Febriani's user avatar
1 vote
0 answers
51 views

Linq to Sql query self join with grouping c#

I have following tables Machine table public class MachineUpdate : DbContext { public int MachineUpdateId { get; set;} public int MachineId { get; set;} public string MachineName { get; ...
csharpnewbie programmer's user avatar
0 votes
1 answer
142 views

Linq Error Cannot Operate on Variables of Anonymous Type

Apparently I've gone silly on Wednesday morning. I have linq error that I should know the answer. Sorry for the stupid question. var results1 = (from p in db1.a_PCRs join je in db1....
Bernie Hunt's user avatar
0 votes
0 answers
55 views

Linq to SQL Cannot attach an entity that already exists

I am getting a error Cannot attach an entity that already exists. at the line DbSet.Attach(entity); . Is there something I need to do different before the update? Should I add a if condition to the ‘...
Jefferson's user avatar
  • 137
0 votes
1 answer
190 views

Linq Query for a particular scenario

Class Demo { public int Id{get;set;}; public string Name{get;set;} public int Parent{get;set;}; public IList<Demo> children{get;set;} } Now my code returns List demos. The data is ...
somnath roy's user avatar
0 votes
1 answer
290 views

Handling DateTimes with Linq Expression

I'm trying to create a Linq Expression to compare a date column with DateTime.Now Here's my code private void ProcessQueueEntries() { _logger.LogInformation("ProcessQueueEntries"); ...
Simon Woods's user avatar

15 30 50 per page
1
2 3 4 5
354