LINQ中怎么使用LIKE方法?

linq怎么用SQL中的LIKE方法呢?

  • lucifer - 1年前

    var result = from o in db.Orders
         join od in db.Order_Details on o.OrderID equals od.OrderID
         where SqlMethods.Like(o.ShipCountry, txtKeyWord.Text)
                 select new newItem
                 {
                     rderID = o.OrderID,
                     CustomerID = o.CustomerID,
                     ShipName = o.ShipName,
                     ShipCity = o.ShipCity,
                     ShipCountry = o.ShipCountry,
                     UnitPrice = od.UnitPrice,
                     Quantity = od.Quantity
                 };

  • neptune - 1年前

    linq有个SqlMethods静态类,它里面就有提供like方法,你可以看下