简体   繁体   English

如何 select 记录具有特定日期的日期或今天的日期并增加 LINQ 中的最高序列号(int 或 id)?

[英]How to select the records with the particular date day or today's date and increment highest sequence number (int or id) in LINQ?

I need to select the records with the particular date day and increment highest sequence number (int or id) in LINQ, how todo this?我需要 select 记录具有特定日期的日期,并在 LINQ 中增加最高序列号(int 或 id),该怎么做?

Select your date day or DateTime.UtcNow.Date or DateTime.Today Select 您的日期日期或DateTime.UtcNow.DateDateTime.Today

_Dbcontext.DbTable.SequenceIntegerColumn = _Dbcontext.DbTable.Where(x => x
.DateColumn.Value.Day == DateTime.UtcNow.Date)
.Max(n => n.SequenceIntegerColumn) + 1;

or或者

_Dbcontext.DbTable.SequenceIntegerColumn = _Dbcontext.DbTable.Where(x => x
.DateColumn.Value.Day == DateTime.Today)
.Max(n => n.SequenceIntegerColumn) + 1;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何仅选择 LINQ 中日期最高的记录 - How to select only the records with the highest date in LINQ 如何选择一条记录,仅是LINQ to SQL中日期最高的子级 - How to select a record and only it's children with the highest date in LINQ to SQL 如果今天没有记录,如何发出警报 - How to throw alert if no records for today's date 如何编写SQL查询以返回数据库中每年的TODAY的DATE(月和日)的所有“历史记录”? - How To write an SQL query to return all “historical records” for TODAY'S DATE (month and day) for EVERY YEAR in the DB? 如何编写LINQ to SQL查询以获取今天的日期记录? - How to write LINQ to SQL query for getting today date records? Linq查询如何从今天的日期中选择上一周的数据 - Linq query how to select last one week data from today's date Linq选择最接近日期的记录 - Linq select records closest to date 将日期字段与 linq 查询中的今天进行比较 - Compare Date field with the Today's in the linq query 如何 select 记录用户的项目历史记录,其中 LINQ 到实体 lambda 中的项目的日期是最新的? - How to select records of user's history of items, where the date is latest for the items in LINQ to entities lambda? 如何使用C#在linq中选择特定日期的数据 - How to select data for particular date in linq using C#
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM