Get RowNumber with linq to sql in c#
Query:
var itemlist = db.Items.Where(x => x.UserId == Id && DbFunctions.TruncateTime(x.LoanDueDate.Value) < DbFunctions.TruncateTime(DateTime.Now)).AsEnumerable().Select((r, i) => new { i=i+1, r }).ToList();
Try using this query, It'll help :)
var itemlist = db.Items.Where(x => x.UserId == Id && DbFunctions.TruncateTime(x.LoanDueDate.Value) < DbFunctions.TruncateTime(DateTime.Now)).AsEnumerable().Select((r, i) => new { i=i+1, r }).ToList();
Try using this query, It'll help :)
Comments
Post a Comment