2009-06-12 6 views
0

besoin d'une conversion de vb.net du ci-dessous: question orginal à LINQ To SQL "Group By"Conversion C# pour VB.net LINQ to sql

from S in SERVER 
join H in SERVERHDD on S.Server_ID equals H.Server_ID 
join FILTER in 
(from s in SERVERHDD group s 
     by new {s.Server_ID, s.Letter} 
     into groupedServerHDD select new 
       { 
         SERVERHDD_ID = groupedServer.Sum(gS=>gS.ServerHDD_ID) 
       } 
) 
on H.ServerHDD_ID equals FILTER.SERVERHDD_ID 
orderby S.Hostname, H.Letter 
select S 

Merci à l'avance.

+0

Vous pouvez essayer refactormycode.com. –

Répondre

0

À partir de http://www.developerfusion.com/tools/convert/csharp-to-vb/ et non testé.

Dim x = From S In SERVER _ 
    Join H In SERVERHDD On S.Server_ID = H.Server_ID _ 
    Join FILTER In (From s In SERVERHDD _ 
     Group s By New()IntogroupedServerHDD _ 
     Select New()) On H.ServerHDD_ID = FILTER.SERVERHDD_ID _ 
    Order By S.Hostname, H.Letter _ 
    Select S 
+0

Merci Mathew pour le guidage: Got this résolu comme: Dim query = De S En db.SERVERs _ Rejoindre H Dans db.SERVERHDDs Sur S.Server_ID = H.Server_ID _ Rejoindre FILTER In (De s Dans db.SERVERHDDs _ Groupe s par s.Server_ID, s.Letter _ Dans ServerHDD_Ids = Somme (s.ServerHDD_ID) Trier par ordre croissant ServerHDD_Ids) _ On H.ServerHDD_ID = FILTER.SERVERHDD_ID _ Trier par S.Hostname, H.Letter _ Sélectionnez S – Sreedhar

+0

@Nev_Rahd: vous souhaiterez peut-être modifier votre message et ajouter la solution résolue sous votre question. Il est beaucoup plus facile à lire avec la coloration syntaxique du code approprié. – alextansc