Hi steve,
The LIKE operator syntax is:
match_expression [ NOT ] LIKE pattern [ ESCAPE escape_character ]
Where _pattern _represents a fixed string with wildcards.
So you must use **CHARINDEX **(for SQLServer) or **InStr **(for MSAccess)
MSAccess wrote:
InStr
Returns a Variant (Long) specifying the position of the first occurrence of one string within another.
Syntax
InStr([start, ]string1, string2[, compare])
So if the function result is greater than 0, the string2 has found in string1!
I tested this and works fine
// define the dbfunction call to compare
DbFunctionCall fnInstr = new DbFunctionCall("InStr", new object[] { CustomersFields.City, CustomersFields.Country});
// use fnInStr at you filter
IPredicateExpression filter = new PredicateExpression();
filter.Add(CustomersFields.Country.SetExpression(fnInstr) > 0);
At your code would look like:
// define the dbfunction call to compare
DbFunctionCall fnInstr = new DbFunctionCall("InStr", new object[] { CategoriesFields.CategoryName, SuppliersFields.Name});
// use fnInStr at you filter
IPredicateExpression filter = new PredicateExpression();
filter.Add(CategoriesFields.CategoryName.SetExpression(fnInstr) > 0);