这是神马情况?ObjectParameter传入参数不对了
时间:2011-01-13 来源:月小
String esql = @"select Value it from DataMartEntities.Companies as it ";
ObjectQuery<Company> query = entities.CreateQuery<Company>(esql);
query = query.Where("it.Company_Name_CN like '%@name%'");
query.Parameters.Add(new ObjectParameter("name", "XXX公司");
return query.ToList<Company>();
代码2
String esql = @"select Value it from DataMartEntities.Companies as it ";ObjectQuery<Company> query = entities.CreateQuery<Company>(esql);
query = query.Where("it.Company_Name_CN like '%"+"XXX公司"+"%'");
return query.ToList<Company>();
代码2跟代码1照理应该没区别才对,为什么代码1不能返回记录,代码2可以呢?
还是说参数字符有什么限制? 求解
相关阅读 更多 +