I'd like to convert a lambda expression into a SQL query. To do this, I have done:
public class User
{
public string FirstName {get; set;}
public string LastName {get; set;}
public string Address {get; set;}
public int Age {get; set;}
}
var user = new List<User>();
IQueryable<User> query = user.Where(x => x.Age >= 33).AsQueryable();
The 'query' variable is {System.Linq.Enumerable+WhereListIterator`1[Domain.User]}.
However I want the IQueryable<User> query = user.Where(x => x.Age >= 33).AsQueryable();
code becomes 'select FirstName, LastName, Address, Age from User where Age >= 33'
How can I do this?
Important note:
- I am not using EF because the data base is OLE DB.
user.AsQueryable().Where(x => x.Age >= 33)
-List<>
. What LINQ provider are you using to access OLEDB?