473,767 Members | 2,198 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Begin LoadData method for each table in the DataSet, then call
ReadXml. Finally, call DataTable.EndLo adData 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(DataTab le t in ds.Tables)
t.BeginLoadData ();
ds.ReadXml("dot NET.xml");
// Here okay I may know how many table since I loaded the XML data.
foreach(DataTab le t in ds.Tables)
t.EndLoadData() ;

How can this code improve reading large XML performance?
Cheers,
Kids
Nov 16 '05 #1
1 3156

"kids_pro" <ki******@yahoo .com> schrieb im Newsbeitrag
news:%2******** ********@TK2MSF TNGP10.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.Begin LoadData method for each table in the DataSet, then call ReadXml. Finally, call DataTable.EndLo adData 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("dot NET.xml",System .Data.XmlReadMo de.ReadSchema);

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

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

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4496
by: Patrick J. Schouten | last post by:
I am trying to transfor an XML document prior to loading into a Dataset. My problem stems from the known bug in Visual Studio that prevents loading a well formed XML because of duplicate child names: http://support.microsoft.com/default.aspx?scid=kb;en-us;325696 Anyway, I want to transform the XML using the XSLT to get around this problem, but I am having a tough time coming up with a way to apply the XSLT before loading it into the...
3
1436
by: Mauricio Correa L. | last post by:
Hello, i have a string with a XML inside, but when a try lo load a dataset with the next code. Dim all As String = Webservice.getName(TextName.Text, TextNo2.Text).ToString 'this webmethod return a string wit a XML inside Dim xmlreader As New System.IO.StringReader(all) Dim datas As New DataSet datos.ReadXml(xmlarchivo) I have the next error
0
1236
by: J-T | last post by:
I have a CSV file which contains comma seperated data that I need to validate against our database.I was thinking about loading that CSV file into a Typed-Dataset which has our database schema in it and then try to load the CSV file into that Typed-Dataset and automatically get all the errors and constarint violations. 1) Is it doable? 2) Because I need to check the foriegn keys as well,Can I loaded the data of those refferecing...
4
357
by: Fred Nelson | last post by:
I have an applicatioin that I'm writing that uses a "case" file that contains over 350 columns and more may be added in the future. I would like to create a dataset with all the column names and only one case record that is delivered by a stored procedure. (I have a stored procedure that works so my question is only on loading the DataSet.) The DataSet will only be used for printing form letters and then will be zapped. I would like...
4
1514
by: mrmagoo | last post by:
I'm building a vb.net Forms project that is getting data from a SQL Server database. One of the main goals of the project is to be really responsive to events, such as textbox change events. I have a textbox for searching, a listbox to display the searched results, and a big textbox (memo) to display the clicked-results of the listbox item. My question is: should I load the controls with objects, and therefore store everything in...
7
1810
by: koonda | last post by:
Hi guys, I am trying to create a web interface in C# using ASP.NET. The database being used is SQL Server. I have some problems loading the tables in the datalist controls. When I run the program the DataList controls are loaded not with tables but something like this: "System.Data.DataRowView" in the three list boxe controls. Because I have three tables and I want to load them in the three list box controls. And then I want to select values...
0
2025
by: Chris | last post by:
Hello, I have a problem with re-loading datasets. As a simple example, if I have an SQL table of addresses comprising active and inactive addresss, I wish to load either sub-set by clicking on a checkBox. The data is Bound to various controls on a Windows Form. This works fine, I can load either set of data into the same
6
5067
by: cmorgan76 | last post by:
This is a 2 part question: Part 1: I am accesing a web service that returns an xml string of user information. I am attempting to load the XML into an XMLDocument, save the document, load it into a dataset, and bind the dataset to a gridview. I'm not sure if it's neccesary to save the XML file to disk, but I wanted to make sure it was well formed. It is. No exceptions are caught during the loading and binding process, but my gridview...
2
1872
by: TexasAggie96 | last post by:
I am working on a project where I get a XML datastream back from an application API which may contain a particular value that may be emty. An example of this can be seen below <?xml version="1.0" encoding="iso-8859-1" ?> - <NamedProfileList> - <NamedProfile> <ProfileID>115280</ProfileID> <Name>Generation|Aks G7|16316</Name> <Type>Meter</Type>
0
9404
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10009
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9959
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7381
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6651
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5279
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3929
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.