467,174 Members | 1,358 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,174 developers. It's quick & easy.

Loading dataset from XML

I had come across a code block from Loading a DataSet from XML (.NET
Framework Developer's Guide)
----------------------------------------
NOte If you call ReadXML to load a very large file, you may encounter slow
performance. To ensure best performance for ReadXml, on a large file, call
the DataTable.BeginLoadData method for each table in the DataSet, then call
ReadXml. Finally, call DataTable.EndLoadData for each table in the DataSet
as shown in the following example.

DataSet ds = new DataSet();

// How do I know how many table since I haven't load the XML data yet.
foreach(DataTable t in ds.Tables)
t.BeginLoadData();
ds.ReadXml("dotNET.xml");
// Here okay I may know how many table since I loaded the XML data.
foreach(DataTable t in ds.Tables)
t.EndLoadData();

How can this code improve reading large XML performance?
Cheers,
Kids
Nov 16 '05 #1
  • viewed: 2741
Share:
1 Reply

"kids_pro" <ki******@yahoo.com> schrieb im Newsbeitrag
news:%2****************@TK2MSFTNGP10.phx.gbl...
I had come across a code block from Loading a DataSet from XML (.NET
Framework Developer's Guide)
----------------------------------------
NOte If you call ReadXML to load a very large file, you may encounter slow
performance. To ensure best performance for ReadXml, on a large file, call
the DataTable.BeginLoadData method for each table in the DataSet, then call ReadXml. Finally, call DataTable.EndLoadData for each table in the DataSet
as shown in the following example.

DataSet ds = new DataSet();

// How do I know how many table since I haven't load the XML data yet.
ds.ReadXml("dotNET.xml",System.Data.XmlReadMode.Re adSchema);

foreach(DataTable t in ds.Tables)
t.BeginLoadData();
ds.ReadXml("dotNET.xml");
// Here okay I may know how many table since I loaded the XML data.
foreach(DataTable t in ds.Tables)
t.EndLoadData();

How can this code improve reading large XML performance?
Cheers,
Kids

Nov 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Patrick J. Schouten | last post: by
3 posts views Thread by Mauricio Correa L. | last post: by
4 posts views Thread by Fred Nelson | last post: by
reply views Thread by Chris | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.