Question

I want to convert it into entity framework Lambda Expression, but i'm not getting proper syntax...

What will be the Entity Framework Lambda Expression of this SQL query:

   DataTable DT=Select CityName,CityId from City order by cityname;

AND I Want to store it in Datatable also. so how can i do this In MVC With using Linq Lambda expression....

Était-ce utile?

La solution

first take your context entities as below

private Entities db = new Entities();

var city = db.cities.select(c => new { c.CityName , c.CityId}).OrderBy(c=> c.CityName);

db.citites.add(city);

db.SaveChanges();

for more information :-

http://onsaurav.blogspot.in/2013/02/beginning-of-entity-framework-with-mvc.html

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top