Hi, sorry for the late response, the current code I have is as follows:
string code = "HA262";
IExpression leftSubOp = new Expression(" ", ExOp.Add, ProductsFields.Contents);
IExpression leftOperand = new Expression(leftSubOp, ExOp.Add, " ");
string rightOperand = "% " + code + " %";
EntityField ContentsField = ProductsFields.Contents.SetExpression(leftOperand);
IPredicateExpression filter = new PredicateExpression();
filter.Add(new FieldLikePredicate(ContentsField, rightOperand));
ProductsCollection proCol = new ProductsCollection();
try
{
proCol.GetMulti(filter);
}
catch (ORMQueryExecutionException ex)
{
System.Console.WriteLine(ex.QueryExecuted);
}
Above code will execute successfully without exception, but with 0 result return.
The queryExecuted by the codes above is as follows:
[_Products].* FROM [_Products] WHERE ( ( (@LO25f14a92 + [_Products].[Contents]) + @LO2b6
a1ca3 LIKE @Contents1))
Parameter: @Contents1 : String. Length: 9. Precision: 0. Scale: 0. Direc
tion: Input. Value: "% HA262 %".
Parameter: @LO25f14a92 : String. Length: 1. Precision: 0. Scale: 0. Dire
ction: Input. Value: " ".
Parameter: @LO2b6a1ca3 : String. Length: 1. Precision: 0. Scale: 0. Dire
ction: Input. Value: " ".
The actual queryExecuted actually lists out all of the fields individually, I used .* instead since there are a lot of fields...
Then I use a direct query in MS Access 2003:
SELECT *
FROM _products
WHERE ' '+contents+' ' like "* HA262 *"
returns 4 results
Thanks for all of your help once again!