【问题标题】:Master Detail in Winform using LINQ使用 LINQ 在 Winform 中掌握详细信息
【发布时间】:2014-02-16 02:22:33
【问题描述】:

我正在寻找 VB.NET 代码来加入 2 个表以使用 LINQ 完成 Winform 的 Master Detail。

我在 C# 中找到了以下代码 sn-p。但是 VB.NET 编译器不喜欢这种语法。

请提供正确的 VB.NET 代码(我相信INTO 是错误原因):

var matchingEmployees = 
     from dept in Departments
     join emp  in Employees on dept.DeptNo equals emp.DeptNo
     INTO AvailableEmployees
     SELECT NEW { department = dept, employees = AvailableEmployees }; 

参考:代码项目中的文章“Creating Master Detail representation of data display in Winforms using LINQ (C#)

【问题讨论】:

    标签: vb.net linq master-detail


    【解决方案1】:

    我认为这应该是 VB.NET 中的 Group Join

    Dim matchingEmployees = 
            From dept In Departments _
            Group Join emp In Employees On dept.DeptNo Equals emp.DeptNo _
            Into AvailableEmployees = Group _
            Select New With {.department = dept, .employees = AvailableEmployees}
    

    参考资料:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-03-21
      • 1970-01-01
      • 2019-03-29
      • 1970-01-01
      • 2013-02-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多