Posts
400
Comments
213
Trackbacks
0
Das Ergebnis einer LinQ to SQL Abfrage nachträglich sortieren

Neulich hatte ich eine LINQ to SQL Abfrage welche nach einem ermittelten Wert sortiert werden sollte, normalerweise macht man dies mit Order By innerhalb der LinQ Abfrage. In meiner Aufgabenstellung (die LinQ-Abfrage war komplex) funktionierte dies nicht.

Dann boten sich die folgende Lösung an:

Dim ret as new Object

ret = (From status In tableStatus _

       Select status.STATUS_ID, _

       Text = Function_GetText(status.TEXT_ID) _

       ).toList.OrderBy(Function(a) a.Text)


oder andere Variante:

Dim tmp = From status In tableStatus _
          
Select status.STATUS_ID, _

          Text = Function_GetText(status.TEXT_ID)

Dim ret = (From x In tmp Order By x. Text Select x

posted on Wednesday, December 08, 2010 7:37 PM Print
Comments
No comments posted yet.

Post Comment

Title *
Name *
Email
Url
Comment *  
Please add 6 and 6 and type the answer here: