1) You should drag and drop your Table1 into an edmx file to generate entity model.
2) And then You can try this:
var result = from item in xxx.Table_1.AsNumerable()
order by item.CNumber
select new
{
Property1 = item.Value1,
………………
CNumber = Convert.ToInt32(item.CNumber)==1?item.CNumber.Length:99
};
3) If my above sample fails, this mean that your SQL cannot be converted to LINQ, Please use this convert tool to help you:
htmbarnamene...
0 Points
1 Post
What is the equivalent statement in entity framework?
Dec 23, 2012 02:11 AM|LINK
Hi
I have a problem . i have this statement in sql and i have the equivalent statement in entity framework
select * from Table_1 ORDER BY IsNumeric(CNumber) DESC, CASE WHEN IsNumeric(CNumber) = 1 THEN Len(CNumber) ELSE 99 END, CNumberCNumberis field in my table and I sort it,CNumberis string with numbers</div>please help me
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: What is the equivalent statement in entity framework?
Dec 24, 2012 12:14 AM|LINK
Hi,
1) You should drag and drop your Table1 into an edmx file to generate entity model.
2) And then You can try this:
var result = from item in xxx.Table_1.AsNumerable() order by item.CNumber select new { Property1 = item.Value1, ……………… CNumber = Convert.ToInt32(item.CNumber)==1?item.CNumber.Length:99 };3) If my above sample fails, this mean that your SQL cannot be converted to LINQ, Please use this convert tool to help you:
http://sqltolinq.com/