简体   繁体   中英

xml to datatable

can i load data from xml to data table?i don't want to use loop anymore. now i develop in c#.net 2008.my xml format may be like below.

<ItemCode>001</ItemCode>
<ItemName>Item001</ItemName>
<Qty>50</Qty>
<Price>100</Price>
<Amt>5000</Amt>
<ItemCode>002</ItemCode>
<ItemName>Item002</ItemName>
<Qty>70</Qty>
<Price>100</Price>
<Amt>7000</Amt> 
<ItemCode>003</ItemCode>
<ItemName>Item003</ItemName>
<Qty>90</Qty>
<Price>100</Price>
<Amt>9000</Amt>

Regards Han

Yes. You should look at DataTable.ReadXML

http://msdn.microsoft.com/en-us/library/yfxbc3by%28v=VS.90%29.aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM