我是 Linq 的新手,以下查询不断返回“无法识别 System.DateTime”错误。我试过 Parse 和 Convert 都没有。这是我的查询:
mrcEntities 上下文 = GetContext();
var query = from c in context.tblClients
where (c.FirstName != null || c.LastName != null)
&& c.EligibilityDate >= DateTime.Parse("10/01/2011")
&& c.EligibilityDate <= DateTime.Parse("04/30/2012")
orderby c.ClientID
select new
{
ClientID = c.ClientID,
FirstName = c.FirstName,
LastName = c.LastName,
MiddleName = c.MidName,
SSN = c.SSN,
DOB = c.DOB,
Sex = c.Gender,
Ethnic = c.EthnicCode
};
clientRowCnt = query.Count();
任何帮助,将不胜感激。