c# - 读取时重构 xml

标签 c#

我想将第一个数据表结构转换为第二个表结构,如图所示 请帮我解决这个问题

F1      F2     F3     F4     F5
Group   1      2      3      4 
Design  5      6      7      8

F1      Value
Group   1   
Group   2   
Group   3   
Group   4
Design  5      
Design  6  
Design  7  
Design  8  

XML

<WK11>
  <F1>Group</F1> 
  </WK11>
<WK11>
  <F1>1</F1> 
  <F2>2</F2> 
  <F3>3</F3> 
  <F4>4</F4> 
</WK11>
<F1>Design</F1> 
  </WK11>
<WK11>
  <F1>5</F1> 
  <F2>6</F2> 
  <F3>7</F3> 
  <F4>8</F4> 
</WK11>
</WK11>

最佳答案

我建议使用 UNPIVOT 子句让 SQL Server 执行此操作,然后您可以根据需要阅读它。更多信息请引用this other question

关于c# - 读取时重构 xml,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2537305/

相关文章:

c# - 从 .kar 文件中读取歌词信息

c# - 从 T4 更改 EF 6 代码生成策略

c# - Telerik Open Access 错误 : Exception: System. ArgumentNullException : Value cannot be null. 参数名称:converterName

c# - ADO.NET 实体对象生成器

c# - 使用 PInvoke 的 CryptoAPI 的 SignerTimeStampEx2

c# - 如何在路径上设置渐变动画以在 WPF/WCF 应用程序中可视化数据流

c# - 在接口(interface)方法中访问接口(interface)实现者的类型

c# - 我可以规定 C# 类型参数只能是接口(interface)类型吗?

c# - 如何将值从 ASP.NET MVC Controller 传递到 MVC View 内的 ASP.NET Webforms 控件?

c# - Unity 框架和多构造函数注入(inject)