I am using a LinqToSql-DataSource for a GridView in this way: Now i want to order the Selection. At first the “stammVerein”-Column of Table “mitgliedschaft” descending AND the Column “eintritt” of Table “mitgliedschaft”. I have tried several ways: AND: AND: But nothing of this has any Effects ! I am very new in this kind of DataSource and Linq. Can
Tag: linq
Linq tolist() count returns different value from translated sql
I have a situation where the translated sql direct form Visual Studio is returning a different number of records from the Linq. I am expecting 4 items but in the count() of the resulting list I only have 1. This is the case despite creating more records – it always returns 1. Strange thing is I have the same linq
Filter and Match Column on a List of Substrings
I am attempting to filter a table of user actions on a list of specific actions. For example, given the following data I want all rows where the UserAction contains the strings “Account Creation” or “Attempt to create duplicate account”. I was able to achieve this with the following Linq, but the query’s performance caused the webpage to timeout and
SQLDateTime OverFlow with Correct DateTime Format
below is my code snippet where I insert a DateTime value to SQL database and encountered the following error: System.Data.SqlTypes.SqlTypeException: SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM. May I know if there is a format to be used? when converting the value of row.DeliveryDate? Answer actually the problem is SQL DateTime =/= C# Datetime you
How to update existing child class by using the parent id
Currently I have somes idea where we get the child data from its parent Id, and update the child data with hardcoded text. Parent Class: ` ` Child Class The situation is when the when i need to update all child status column to “Confirm”, i need to find it parent class first by search the rideId and if the
How to get average value using LEFT JOIN in LINQ and Lambda
I want to display each book average rating with its publisher using LINQ and Lambda. Here’s my book list private List
How to combine same result into one row after inner join in LINQ
I’m new in ASP.NET and LINQ. I want to display book name, publisher name, and author name in index page. One book can have more than one author. my query for display the result is like this var …
Convert SQL query to Entity Framework which used AggregateFunctions and Where clause
How can I convert this query to Entity Framework? SQL query: SELECT Fullname, SUM(CoinCount+DiamondCount) AS GeneralPoint FROM Students, Groups WHERE Students.GroupId = Groups.Id AND Groups.Name = ‘…
How to write Inline If Statement(SQL IIF) in EFCore Select?
I have the following Customer table: Id First Last LocationId 0 John Doe 2 1 Mary Smith 4 My use case requires column level permissions(predicated on a value in the Entity’s …
How to update two columns with same name from two tables in a join query
I am getting an error: Property or Indexer cannot be assigned to “–” it is read only when trying to update two columns with the same name in two tables in a join query. How do I get this to work? …