Jul 15 2007

Read Large XML File into a DataSet

Category:Bil@l @ 13:52

While preparing my lectures for the 2541- Core Data Access I noticed a very nice comments on the MSDN website which talks about loading large XML files into a DataSet.

When you have a large XML file, the recommend way to load it to a DataSet is as follows:

 foreach (DataTable t in ds.Tables)
  t.BeginLoadData();

 ds.ReadXml("file.xml");
 
 foreach (DataTable t in ds.Tables)
  t.EndLoadData();

The BeginLoadData turns off any notifications while loading the data.

Hope this helps you,
Regards

Tags:

Comments are closed