const string keyword = "manoj";
rsp.DataSource = company.GetCompanySearch(keyword);
rsp.DataBind();
public List<Company> GetCompanySearch(string keyword)
{
using (var context = huntableEntities.GetEntitiesWithNoLock())
{
List<Company> query = context.Companies.ToList();
if (!string.IsNullOrEmpty(keyword))
{
keyword = keyword.ToLower();
query = (List<Company>) query.Where(u=>u.CompanyName.Contains(keyword)
|| u.EmailAdress.Contains(keyword)
||u.MasterCountry.Description.Contains(keyword)
||u.MasterIndustry.Description.Contains(keyword)
||u.CompanyDescription.Contains(keyword)
||u.CompanyHeading.Contains(keyword));
}
return query.ToList();
}
}
以下代码引发以下异常:{“无法转换类型为 'WhereListIterator 1[Data.Company]' to type 'System.Collections.Generic.List
1[Data.Company]' 的对象。”}