的操作數,我使用LINQ查詢,但得到錯誤 Cannot apply operator >= to operands of type system.datetime and string
得到錯誤不能申請運營商類型的System.DateTime和字符串
這裏是我的LINQ查詢
var myBirthDate= BirthDate.ToString("yyyy-MM-dd HH':'mm':'ss");
var myList= (from myEntity in myEntityRepository.AsQueryable()
where
myEntity.id== Id &&
myEntity.birthdate >= myBirthDate
select myEntity).Take(1);
我轉換日期到yyyy-MM-dd HH':'mm':'ss
格式因爲我從客戶端獲得其他格式。
我該如何避免此錯誤?
異常消息是自我描述性的! – 2014-11-06 10:09:51