Click here to Skip to main content
15,907,001 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I want convert this linq query into sql

C#
int take=10, pageSize=10
var jobsdata = from n in context.Jobs.OrderByDescending(o => o.Id).Take(take).Skip(pageSize) select n;


Please help me......
Thank you....
Posted

with x as (SELECT ROW_NUMBER() over(order by Id asc ) as row ,* from Jobs where id='1'

)select * from x where row between (1) and (@take)
 
Share this answer
 
Get the TSQL Query from LINQ DataContext.SubmitChanges()
There is actually a very simple answer to your question

Just paste this in your watch window

C#
((System.Data.Objects.ObjectQuery)myLinqQueryVar).ToTraceString()
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900