Click here to Skip to main content
15,790,135 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#?

Share this answer
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();
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
Pandvi 14-Jun-12 23:39pm    
Good work! my 5!
F. Aro 14-Jun-12 23:44pm    
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
Check the below link it has the detailed code

Convert XML To Datatable in[^]

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