将C#转换为VB.net Linq转换为Sql

时间:2022-03-09 19:00:36

Need vb.net conversion of the below: orginal question at LINQ To SQL "Group By"

需要vb.net转换如下:LINQ To SQL“Group By”的原始问题

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

Thanks in Advance.

提前致谢。

1 个解决方案

#1


From http://www.developerfusion.com/tools/convert/csharp-to-vb/ and untested.

来自http://www.developerfusion.com/tools/convert/csharp-to-vb/并且未经测试。

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

#1


From http://www.developerfusion.com/tools/convert/csharp-to-vb/ and untested.

来自http://www.developerfusion.com/tools/convert/csharp-to-vb/并且未经测试。

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