var datatemp = from a in db.vw_ipos_kehutree
orderby a.sx1_id
select new { zd_id = a.zd_id,khdm=a.khdm ,khmc=a.khmc ,zzmc=a.zzmc ,qymc=a.qymc };
vw_ipos_kehutree为一个视图 在给datatemp加like查询时
datatemp =datatemp.where(k=>k.khdm.Contains("dd"));这样就正确
如果
datatempdatatemp.where(k=>k.khdm.Contains(where));这样就报错(where为从前台传过来的字符串)错误明细是“Unknown column ‘Extent1.khdm‘ in ‘where clause‘”
原文:http://www.cnblogs.com/xjt360/p/3875441.html