Click here to Skip to main content
15,889,833 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am working with the xml files.I am trying to convert the xmldatasource to datatable.But I don't know how to do that.Can anyone help me?

This is the sample xml file

<surveys>
<survey id="1" desc="data">
<survey id="2" desc="dddd">

Posted
Updated 13-Dec-12 6:17am
v2

 
Share this answer
 
Comments
priya9826 13-Dec-12 12:02pm    
This is the xml file which contains data like below::


<surveys>

<survey id="12" description="12/30/2012 - ABC">
<survey id="37" description="11/18/2012 - DEF">
<survey id="14" description="12/31/2014 - GHJ">


How can I convert this in to datatable?

How to convert this
priya9826 13-Dec-12 12:03pm    
<surveys>
<survey id="1" desc="Data">
Jibesh 13-Dec-12 12:42pm    
dont see anything xml data in your post.
Hello!
I had this issue too. And I've found solution.
C#
DataTable dt = new DataTable();
DataSet ds = new DataSet();
ds.ReadXml(new XmlNodeReader(xmlDS.GetXmlDocument())); // xmlDS - XmlDataSource
dt = ds.Tables[0];
 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900