All Questions
Tagged with linq linq-to-sql
5,308
questions
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 ...
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 ...
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)]
...
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 ...
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 = '"...
-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:...
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....
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 ...
-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
...
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 ...
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; ...
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....
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 ‘...
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 ...
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");
...