23
12/11
linq里LIKE的几种用法
方法1:Using String.StartsWith or String.Endswith var q = from c in db.Customers where SqlMethods.Like(c.CustomerID, "C%") select c; 方法2.Using SqlMethods.Like method C# code var query = from c in ctx.Customers where SqlMethods.Like(c.City, "L_n%") select c; 方法3: var q =from c in db.Customers where c.CustomerID.IndexOf("C")>-1select c; 方法4:当然是用CONTAINS了,不过这个只能实现 LIKE '%keyword%'这种 方法5:等你来完成!哈哈