net,我正在.net 中开发应用程序。
我收到以下错误,我不知道我的代码有什么问题
LINQ to Entities does not recognize the method 'System.String ToString()' method, and this method cannot be translated into a store expression.
这是我的代码,异常即将到来。
public List<ToureDeieselBean> loadDeiselListOnTourUpDownId(int tourUpDownId)
{
return (from p in context.tb_tourDiesel
where p.deleted == 0
where p.tourUpDownId == tourUpDownId
select new ToureDeieselBean
{
id = p.id,
qty =(float)p.qty,
ratePerlt = (float)p.ratePerlt,
createdBy = p.createdBy,
createdOn = p.createdOn==null?"":(p.createdOn).ToString(),
updatedBy = p.updatedBy,
updatedOn = p.updatedOn == null ? "" :(p.updatedOn).ToString(),
descrption=p.descrption,
deleted=Convert.ToBoolean(p.deleted)
}).ToList<ToureDeieselBean>();
}