C
Chris Hardie
Hi,
For kicks I'm building expression trees to query my linq-to-entities
provider. Everything works fine, except for one WHERE clause
constraint that I don't know how to build. I want to check to see if
some text is contained in the memo field, but I haven't the faintest
idea how to do that.
ParameterExpression pe =
Expression.Parameter(typeof(LogBookTransaction), "log");
IQueryable queryableData = context.LogBookTransactions.AsQueryable();
Expression left = Expression.Property(pe,
typeof(LogBookTransaction).GetProperty("EmployeeNumber"));
Expression right =
Expression.Constant(Decimal.Parse(selEmployee.SelectedValue),
typeof(decimal);
Expression e1 = Expression.Equal(left, right); //Here i check to
ensure equality
Expression left = Expression.Property(pe,
typeof(LogBookTransaction).GetProperty("Memo"));
Expression right = Expression.Constant(txtSearch.Text,
typeof(string));
Expressions e2 = ??? //There is no Expression.Contains method
***SNIP***
I'm looking for how to do the following in SQL:
WHERE memo LIKE '%myText%'
Any ideas?
Thanks!
For kicks I'm building expression trees to query my linq-to-entities
provider. Everything works fine, except for one WHERE clause
constraint that I don't know how to build. I want to check to see if
some text is contained in the memo field, but I haven't the faintest
idea how to do that.
ParameterExpression pe =
Expression.Parameter(typeof(LogBookTransaction), "log");
IQueryable queryableData = context.LogBookTransactions.AsQueryable();
Expression left = Expression.Property(pe,
typeof(LogBookTransaction).GetProperty("EmployeeNumber"));
Expression right =
Expression.Constant(Decimal.Parse(selEmployee.SelectedValue),
typeof(decimal);
Expression e1 = Expression.Equal(left, right); //Here i check to
ensure equality
Expression left = Expression.Property(pe,
typeof(LogBookTransaction).GetProperty("Memo"));
Expression right = Expression.Constant(txtSearch.Text,
typeof(string));
Expressions e2 = ??? //There is no Expression.Contains method
***SNIP***
I'm looking for how to do the following in SQL:
WHERE memo LIKE '%myText%'
Any ideas?
Thanks!