0

我有一个 EDS,它使用 DateTimes 查看事件列表,我想要一个查看某一天所有事件的 where 参数。

我想要一个看起来像这样的地方:

Where="it.EventStartDateTime = @testDate"

但由于EventStartDateTime包含时间,而testDate是唯一的日期,它们永远不会匹配。

我试过了

Where="it.EventStartDateTime.Date = @testDate"

但我收到一个关于Date不在架构中的错误(?)

我试过了

Where="it.EventStartDateTime Like @testDate"

这也不起作用。

有谁知道如何做到这一点?

提前致谢

4

1 回答 1

1

通过这样做解决了这个问题:

        eventsEDS.Where = "it.EventStartDateTime >= @cDate && it.EventStartDateTime < @cDate1 "; 
        eventsEDS.WhereParameters.Add("cDate", TypeCode.DateTime, eventStartDateTime.ToShortDateString());
        eventsEDS.WhereParameters.Add("cDate1", TypeCode.DateTime, eventStartDateTime.AddDays(1).ToShortDateString());

不理想但有效

于 2013-11-12T13:46:24.097 回答