我运行这个linq查询然后我收到错误“不允许从数据类型bigint到时间的显式转换。”如果直接将f.a.dtStartTime设置为tsStart,则没有错误。我尝试了很多,但没有理解那里出了什么问题。请帮我解决这个错误。
var data = m_ctx.Stores
.Where(f => (f.dtStartDate >= dtFromDate & f.dtStartDate <= dtToDate) ||
(f.dtEndDate >= dtFromDate & f.dtEndDate <= dtToDate))
.Join(m_ctx.Custs, a => a.iID, b => b.iID, (a, b) => new { a = a, b = b })
.Select(f => new
{
dtFrom = ((f.a.dtStartDate < dtFromDate) ? dtFromDate : f.a.dtStartDate),
dtTo = ((f.a.dtEndDate > dtToDate) ? dtToDate : (f.a.dtEndDate ?? DateTime.Now.Date)),
tsStart = ((f.a.dtStartDate < dtFromDate) ? TimeSpan.Zero : f.a.dtStartTime),
tsEnd = ((f.a.dtEndDate > dtToDate) ? TimeSpan.Zero : f.a.dtEndTime.Value),
});