This is a SL/WPF application, trying to display two columns. The following code:
MyDomainContext context = new MyDomainContext();
dataGrid1.ItemsSource = context.DBTables;
context.Load(context.GetTwoDataBasesQuery())
;
The domainservice.cs contains the method definition as follows:
public IQueryable<DBTable>GetTwoDataBases()
{
return this.ObjectContext.DBTables;
}
This code works fine but returns all columns in the context I need to return only two columns so changed is as follows
public IQueryable<DBTable>GetTwoDataBases()
{
//trying to return columns
return GetDBTables().Select(m => new { m.col1, m.col2 });
}
But compiler generates errors, does not accept the “return”.
following error Cannot implicitly convert type 'System.Linq.IQueryable' to 'System.Linq.IQueryable'. An explicit conversion exists.
How to return two columns only? many thanX