【问题标题】:linq2sql to group resultslinq2sql 对结果进行分组
【发布时间】:2012-06-15 14:07:25
【问题描述】:

我的 sql 存储过程返回以下输出。

type_id description
------- -----------

1        Name details
3       FirstName
3       SurName
1      Address details
3      firstLine
3      LastLine
1      Employment details
2      occupation
3      salary

type_id of 1 是父级,它的子级显示在下面。(直到我读到另一个父级)

我正在使用 Linq2Sql,我喜欢将其转换为 Dictionary>

例如

Name details  
  firstName  
  SurName  
Address details   
  firstLine  
  LastLine  
Employment details  
   occupation  
   salary  

在 linq 中可以吗?

【问题讨论】:

  • 没有办法将“接下来的几个”记录作为孩子来处理,不。您必须通过他们来构建您的 Dictionary 老式方式。
  • 如果有办法将其压缩到 linq 中,经典的方式可能更清晰。

标签: sql linq linq-to-sql


【解决方案1】:

没有办法将“接下来的几个”记录作为孩子来处理,不。您必须通过他们来构建您的 Dictionary 老式方式。

【讨论】:

    猜你喜欢
    • 2012-10-06
    • 2013-07-10
    • 2023-03-23
    • 2011-07-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-09-29
    相关资源
    最近更新 更多