I want to sum all the columns and where context between dates, basically I want to convert the below SQL query to EF: select meterCategory, sum(cost) maxCost from [dbo].[UsageData] where date …
Tag: entity-framework
Entity Framework .NET Core returns ‘Data is Null. This method or property cannot be called on Null values.’ but not in Debugger
The problem: on C#, MVC API with Angular 6 front end on IIS deployed solution. A simple HTML table with 8 filtering fields on specific columns runs queries on the back-end through an API HttpGet call. The function itself works ok, but NOT for specific strings. On the field ‘Description’ for example, the back-end returns ‘Data is Null. This method
Custom select Entity Framework
I want to perform a custom select with Entity Framwork and can not make it good would you help me to figure this SQL select with Entity Framework SELECT DISTINCT Departments.Dept_ID, Departments….
How can i Set decimal value in SQL (something like 10.12345678)
Can’t store decimal value in SQL. Want to store like decimal(2,8) Like 32.12345678 [Column(TypeName = “decimal(2,8)”)] [Display(Name = “Latitude”)] public decimal Latitude { get; set;…
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 = ‘…
SqlClient.SqlException: Invalid column name ClassNameId While fetching data from Fluent API
I am new to this EF,I am tring to fetch data from Sql Db table, and it gives me error like invalid classNameId error. public class ClassName { [Key] [Display(Name = “Id:”)] …
How can I get rid of having to prefix a WHERE query with ‘N’ for Unicode strings?
When searching for a string in our database where the column is of type nvarchar, specifying the ‘N’ prefix in the query nets some results. Leaving it out does not. I am trying the search for a …
How To Convert Linq To Sql?
I want write code for table, I know in SQL Server, but I don’t know Linq or EF. SQL Server code: SELECT * FROM Driver WHERE id IN (SELECT Driver FROM Drive_Car WHERE …
Reference to multiple rows entity-framework?
How can I reference my column in table1 to multiple rows of another table in entity-framework work with custom navigation properties? this problem can be solved in SQL with a temp table which is …
Get FileStream size (sql server) by mvc app context asp net mvc
I would like if .net (asp.net mvc) provides possibility to get size of FileStream having DbContext. As I did research so far I can: 1) SELECT SUM(DATALENGTH(‘ColumnName’))FROM Table 2) SELECT …