entity framework - Select last inserted ten rows -


i using entity framework. want inserted (means last ten) ten rows. table user has 2 columns:

userid password datetime 

how can recent ten rows?

if have datetime (or date) column can use this:

using(yourdbcontext ctx = new yourdbcontext()) {    var lasttenrows = ctx.users.orderbydescending(u => u.datetimecolumn).take(10).tolist(); }  

Comments

Popular posts from this blog

php - cannot display multiple markers in google maps v3 from traceroute result -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -