score:1
You have to get the data to a List<Order>
first and after that you can cast whatever you want.
var orders =
from s in
((from o in db.Orders
where o.Order_Complete
select o).ToList())
select new {
s.Order_Id,
s.MySEL_Name,
s.MySEL_EMail,
s.MySEL_Bus_Name,
Double.Parse(s.Total_Amt),
s.Order_Complete_DateTime
};
I think the EMS way would look much better in your code ;)
var orders =
db.Orders.Where(s => s.Order_Complete).ToList().Select(s => new { /*...*/ }
After casting ToList()
you have got the data object based and can modify it, if you don't you can use Double.Parse
because EF is trying to find e.g. a stored procedure on the database and will throw an exception.
score:0
Have you tried model-defined functions?
<Function Name="ConvertToDecimal" ReturnType="Edm.Decimal">
<Parameter Name="myStr" Type="Edm.String" />
<DefiningExpression>
CAST(myStr AS Edm.Decimal(12, 2))
</DefiningExpression>
</Function>
Check this answer: Convert string to decimal in group join linq query
Source: stackoverflow.com
Related Articles
- LINQ to Entities string to decimal a column
- linq to entities changing database connection string in code
- Linq to entities / EF : join to tables on a decimal and a string field
- Concatenate int and string in LINQ to Entities
- Enumerable.Empty<T>().AsQueryable(); This method supports the LINQ to Entities infrastructure and is not intended to be used directly from your code
- Convert string to decimal in group join linq query
- Dynamic LINQ DateTime Comparison String Building - Linq To Entities
- LINQ to Entities - How to return a single string value from entity
- LINQ to Entities - DISTINCT on one column
- LINQ to Entities split string on result
- linq join on guid and string column
- LINQ Source Code Available
- Creating a LINQ Select expression dynamically from string column names
- Linq Order by when column name is dynamic and pass as a string to a function
- Refactor Linq code and "LINQ to Entities does not recognize the method"
- The given value of type String from the data source cannot be converted to type int of the specified target column
- Perform string search with Linq to Entities
- How to read a string with UTF8 coding using linq to entities
- LINQ compare string and DB column type 'text'
- Sum a string column in linq
- how to convert int to string in Linq to entities
- creating Linq to sqlite dbml from DbLinq source code
- EF Code First - Linq to Entities Union EqualityComparer
- Linq to entities - first letter of string between 2 keys
- Cannot convert type string to decimal in linq query
- linq to entities can not convert int to string
- How to convert a string to decimal in a LINQ query
- LINQ - Accessing a column with the column name as a string parameter
- How to compare a string column to a number (as a decimal) in Linq
- how to get two column values in a single query using linq to entities
- Lambda Expression equivalent of "<>" in from clause of SQL with Join
- The variable SI of type Microsoft.Xrm.Sdk.Entity is refenced on this scope, but it is not defined
- How do I get value from a nested list with reflection?
- EntityFramework LINQToEntities generate weird slow TSQL Where-Clause
- how to compare string linq with sub query with another linq with sub query
- Linq group by date range
- Getting multiple Distinct grouped values in linq
- C# LINQ with wrong order?
- Conditional Select after GroupBy
- Unique object counts are showing system text
- I have some quite simple SQL that I can trying to change to either Linq or LLBLGEN
- How to hit a url from controller in MVC 5 and get the return data from that url to perform some task
- Linq - Retrieve first list after SelectMany
- Looking for an efficient way to retrieve a set of many-to-many children for each row with Entity Framework Core
- Remove rows where column contains specific text
- Compare two complex list objects
- I want to order object within a group in Linq, based on a string and a int
- Asp.net - how does it handle references to database rows?
- Why does Task.WhenAll return void?
- Cast the type 'System.Int64' to type 'System.Object'