I have a Linq query that runs a search in 2 tables (through a "Join"):
First table is tblProducts where master data for any product is saved (Name, Barcode, ItemCode, EnglishName, SpanishName, etc.)
Second table is the warehouse/stocks table, every warehouse have specific stock in it so in here we save the warehouse number and the stock of each product.
When I run the search via VB.Net form for a product called "encendedor" (in spanish) it does not appears in the query results:
Dim result = From t1 In objEntities.tblProducts Join t2 In objEntities.tblWarehouseProducts On t1.Barcode Equals t2.Barcode Where ((t2.WarehouseID = Warehouse) And (t2.InStock > 0)) And (t1.Barcode.Contains(CodBarra) And (t1.SpanishName.Contains(Descripcion) And ((t1.ProductCode.Contains(CodigoSAP) And (t1.ExtCatalogNo.Contains(CodProveedor) And (t1.Brand.Contains(Branch))))))) Select t1
take a special attention to:
where "Descripcion" brings the "encendedor" string.
Now, if I run the query using simple sql commands using SQL Server Management Studio it do finds the result:
select id, USERID, Barcode, ProductCode, ExtCatalogNo, SpanishName, InStock, Brand, Inactive from tblProducts where SpanishName like 'encendedor%'
One thing I have noticed is that if I don't add the '%' at the end of the simple sql command in SQL Server Management Studio it does not finds the result either, so how can I fix my Linq query to find it?
Please your help experts.