我有一个查询需要2个日期时间作为参数,我需要写一个where子句来获取中间的记录。这些不只是日期,但随着时代的日期linq-to-sql之间查询两个日期时间
到目前为止,我这个(即2012年1月28日9:45):
where d.RecordDateTime > StartDate && d.RecordDateTime < EndDate
我应该rewritting这些为:
where d.RecordDateTime > StartDate.Date && d.RecordDateTime < EndDate.Date
还是没问题。
谢谢。
只有你能回答这个简化的方式...你想开始日期日期和结束日期是时间或者你需要在这些日期(00:00至23:59)之间找到任何东西? – Yahia 2012-01-28 13:48:29
是RecordDateTime在DB中定义为DateTime吗? – 2012-01-28 13:52:06
@Yahia:我希望2012年1月26日9时45分和2012年1月27日10时45分或2012年1月11日4时22分和2012年1月19日18时33分时的所有内容。日期和时间都很重要。 – frenchie 2012-01-28 13:52:20