【发布时间】:2014-01-16 13:52:56
【问题描述】:
我正在尝试从具有特定帐号且最近日期早于或等于设置日期时间的数据表中选择一行。我想要以下但只有最新的条目,所以我想在 currentDateTime 之后使用 FirstOrDefault() 或 SingleOrDefault() (即...
DateTime currentDateTime = firstDate;
while (firstDate <= lastDate)
{
foreach (AccountCategory a in db.AccountCategories)
{
var result = Settings.dtCurrent.AsEnumerable()
.Where(b => b.Field<string>("Account") == a.Account
&& (b.Field<DateTime>("Date") <= currentDateTime);
}
}
上面没有给我最近的条目。
【问题讨论】: