本文介绍了Linq to SQL c#SilverLight Search Like的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望我的代码不仅能够匹配确切的结果,还能获得LIKE结果。如何编辑我的LINQ to SQL查询,以便它搜索LIKE结果?



I want my code to not only match exact result, but also LIKE result. How can I edit my LINQ to SQL query so it aslo searches for LIKE results?

[OperationContract]
List<SearchForVessel> GetSearchForVessel(string inpQuery)
{
  PositionDataClassesDataContext context = new PositionDataClassesDataContext();
 
  var res = from etas in context.Lloyds_ETAs
  join vessels in context.Lloyds_Vessels on etas.ImoNumber equals vessels.imo_no
  where etas.ImoNumber.Equals(inpQuery)
  select new SearchForVessel
{
  Vessel_ID = etas.Vessel_ID,
  ImoNumber = etas.ImoNumber,
  Vessel_Name = etas.Vessel_Name,
  Last_Place = etas.Last_Place,
  Last_Place_Location = etas.Last_Place_Location
};
return res.ToList();
}

推荐答案


这篇关于Linq to SQL c#SilverLight Search Like的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-12 12:37