title: Expression tree with sql query
body: <p>I am trying to create an expression tree which will look through my table called test for all strings 'email' in column Foo. I pretty much copied this from the msdn with some small changes and cannot get it to search through my table. Any help getting this expression tree to search would be great. THANK YOU very much</p>
  
  <p>Table Structure called Test</p>
  
  <pre><code>id int
  foo char(10)
  </code></pre>
  
  <p>Error</p>
  
  <blockquote>
    <p>No generic method 'Where' on type 'System.Linq.Queryable' is compatible with the supplied type arguments</p>
  </blockquote>
  
  <pre><code>var s = new m2Entities().Test
  var queryableData = new m2Entities().SaleLogs.AsQueryable&lt;SaleLog&gt;();
  ParameterExpression pe = Expression.Parameter(typeof(string), "foo");
  Expression left = Expression.Call(pe, typeof(string).GetMethod("ToLower", System.Type.EmptyTypes));
  Expression right = Expression.Constant("bar");
  Expression e1 = Expression.Equal(left, right);
  
  MethodCallExpression whereCallExpression = Expression.Call(typeof(Queryable),
                                                             "Where",
                                                             new Type[] { queryableData.ElementType },
                                                             queryableData.Expression,
                                                             Expression.Lambda&lt;Func&lt;string, bool &gt;&gt;(e1,new ParameterExpression[] { pe }));
  var results = queryableData.Provider.CreateQuery&lt;string&gt;(whereCallExpression);
  </code></pre>