Click here to Skip to main content
15,867,956 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
Hai all,

How to convert a XMl File to DataTable using C#?
Posted

 
Share this answer
 
Comments
Espen Harlinn 14-Jun-12 16:39pm    
Good reply, and a nice set of links :-D
Sandeep Mewara 15-Jun-12 2:55am    
Thanks Espen. :)
Add Reference:

Using System.Data;

Use :

DataSet ds = new DataSet();
ds.ReadXml("XmlFilePath");
DataTable dt = ds.Tables[0];
//or dt = ds.Tables["TableName"]
//or dt = ds.Tables[i] , i the index of the table in the xmlfile
 
Share this answer
 
Comments
Pandvi 14-Jun-12 23:39pm    
Good work! my 5!
F. Aro 14-Jun-12 23:44pm    
welcome!
put your answer as solved if it is done.
use method loadfromxml file to the dataset for this issue not datatable!and there is no problem
 
Share this answer
 
Hi
Check the below link it has the detailed code

Convert XML To Datatable in C#.net[^]

Thanks
 
Share this answer
 
v2

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