score:3

Accepted answer

You can use

var Result =
from a in Db.Table
select a;

var ResultSorted = 
from a in Result
orderby a.Field
select a;

foreach(var RowSorted in ResultSorted)
{
    MessageBox.Show(RowSorted.ToString());
}

Edit: The thing is that

select new {TableData = a};

creates a new anonymous type with a field called TableData, like this

class Tmp1
{
     TableType TableData {get; set;}
}

and

select new {All = a};

creates a new anonymous type with a field called TableData, like this

class Tmp2
{
     Tmp1 All {get; set;}
}

Edit 2:
If you select a directly you don't create the extra anonymous type, instead you return the TableType.

score:0

var ResultSorted = 
   from a in Db.Table
   orderby a.Field
   select a.ToString();

Edit: Fixed, didn't see the first query. This should be identical now. There is no need to create anonymous objects all the time.

score:0

You are returning a new instance of an anonymous type in each of your LINQ queries:

select new {TableData = a}; 
select new {All = a}; 

What you are saying to the compiler is (in the first LINQ query), "Give me a new instance of an anoymous type. I want this anonymous type to have one property named TableData and I want the value for that property to be a."

If you simply return a instead of an anoymous type, you shouldn't need to go through the properties of the nested types to get the data. Try this:

var Result =  
from a in Db.Table  
select a;  

var ResultSorted =   
from a in Result  
orderby a.TableData.Field  
select a;  

foreach(var RowSorted in ResultSorted)  
{  
    MessageBox.Show(RowSorted.ToString());  
}  

Related Query

More Query from same tag