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

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

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -