Skip to content
Advertisement

Tag: linq

How to query SQL by month & id to get SUM

I have the table data like: And I want to display asp.net table like: Here is the code to get data by group month and shop code But i don’t know exactly how to display data like image 2 in asp.net html table. Can anyone advise on how to do that in asp.net? Thanks in advance. Answer Create a pivot

Update value if exist or insert in SQL with C# linq

I have this code which is working fine and I update a value if exists or insert if not With this code I manage to do the work with only one query to the SQL, but I was wondering if there is an easier or more elegant way to do it. For example if I could use linq and lambda

Select items with the same foreign key

I have a question regarding Linq in C#. Let’s say that I have 3 tables “Company”, “Employee” and “Job”. Company ——– Id – int (PK) Name – string Employee ——– Id – int (PK) CompanyId – int …

Using LINQ to fill a boolean with true or false based off of condition

I am performing a linq query to grab some data from the DB. Here is my linq: The main 2 tables I am concerned with here are JobRequest and JobRequestParameters… JobRequest table has 13 records (but not all jobs have parameters). JobRequestParameters table only has 4 records. They are joined on by PkJobRequestId. JobRequestParameters has a pkJobParameterId IF and only

Advertisement