第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

LINQ to Entities異常不支持指定的類型成員'Date'

LINQ to Entities異常不支持指定的類型成員'Date'

ibeautiful 2019-11-12 10:15:44
在執(zhí)行以下語句時出現(xiàn)異常。 DateTime result; if (!DateTime.TryParse(rule.data, out result))     return jobdescriptions; if (result < new DateTime(1754, 1, 1)) // sql can't handle dates before 1-1-1753     return jobdescriptions; return jobdescriptions.Where(j => j.JobDeadline.Date == Convert.ToDateTime(rule.data).Date );例外The specified type member 'Date' is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties are supported.我知道例外的含義,但我不知道如何擺脫它。有什么幫助嗎?
查看完整描述

3 回答

?
長風(fēng)秋雁

TA貢獻1757條經(jīng)驗 獲得超7個贊

您可以使用EntityFunctions的TruncateTime方法將屬性正確轉(zhuǎn)換為SQL:Date


using System.Data.Objects; // you need this namespace for EntityFunctions


// ...


DateTime ruleData = Convert.ToDateTime(rule.data).Date;

return jobdescriptions

    .Where(j => EntityFunctions.TruncateTime(j.JobDeadline) == ruleData);


更新: EntityFunctions在EF6中已棄用,使用DbFunctions.TruncateTime


查看完整回答
反對 回復(fù) 2019-11-12
  • 3 回答
  • 0 關(guān)注
  • 1538 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號