Click here to Skip to main content
12,632,234 members (26,030 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# XML C#4.0 DataTable
Hai all,

How to convert a XMl File to DataTable using C#?
Posted 14-Jun-12 5:35am
P_A_1919
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

  Permalink  
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. :)
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

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
  Permalink  
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.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

use method loadfromxml file to the dataset for this issue not datatable!and there is no problem
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 5

Hi

Check the below link it has the detailed code

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

Thanks
  Permalink  
v2

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.161208.2 | Last Updated 18 Feb 2014
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100