开发者

Restructuring the xml when reading

开发者 https://www.devze.com 2022-12-24 06:20 出处:网络
I am want to convert the first datatable sturcture into second table structure as shown Please help me with the approach

I am want to convert the first datatable sturcture into second table structure as shown Please help me with the approach

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&g开发者_运维知识库t;6</F2> 
  <F3>7</F3> 
  <F4>8</F4> 
</WK11>
</WK11>


I'd suggest getting the SQL Server to do it using the UNPIVOT clause, you can then read it as you desire. For more information, please refer to this other question


Use Linq for DataSet or Linq for Xml.

0

精彩评论

暂无评论...
验证码 换一张
取 消