473,797 Members | 3,166 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Very slow speed adding Rows to Dataset

1 New Member
I need to insert rows to a database table after processing a piece of an XML file.
The XML file would look something like:

<Book>
<Chapter>
<Page>
<Paragraph>
<Paragraph>
</Page>
</Chapter>
</Book>

The table I am inserting data into is for the paragraph node. If there are 10 Books, with 12 chapters each of which has 30 pages and each page having Paragraph, then I am talking about ~3600 rows.

Below is the pseudo code for how I am doing this: Its very very slow. It takes about 10 mins to insert 3600 rows. I need a faster way. Can someone please help ? (table.NewRow() seems to be taking a lot of time, about 1 min for approx 360 rows.)


Create connection;
Fill dataset ds;

foreach (XmlNode book in Books)
{
XmlNode Chapters = book.SelectNode s("Chapter");

foreach (XmlNode chapter in Chapters)
{
XmlNode Pages = chapter.SelectN odes("Pages");
foreach (XmlNode Page in Pages)
{
XmlNode paras = Page.SelectNode s("Paragraphs") ;
foreach (XmlNode para in paras)
{
DataTable table = ds.Tables["Para_table "];
DataRow row = table.NewRow();

row[0] = para.Attributes["text"].InnerXml;
row[1] = Page.Attributes["pageno"].InnerXml;
row[2] = chapter.Attribu tes["chapterno"].InnerXml;
row[3] = book.Attributes["title"].InnerXml;

table.Rows.Add( row);
}
}
}
}
Apr 11 '08 #1
0 1276

Sign in to post your reply or Sign up for a free account.

Similar topics

3
4856
by: dror | last post by:
Hello, I have a problem that actually doesn't even make sense. I have 4 million rows in my database. I want to get all records into a DataReader and then read. So if I do it in DAO (either in VB or MFC C++) it takes around 1 second to get the recordset and then around 10-15 seconds to iterate through the recordset. This speed remains the same even if I incorporate an ORDER BY clause: SELECT * FROM myTable ORDER BY customer_id,...
11
17578
by: DJJ | last post by:
I am using the MySQL ODBC 3.51 driver to link three relatively small MySQL tables to a Microsoft Access 2003 database. I am finding that the data from the MySQL tables takes a hell of a long time to load making any kind linkage with my Access data virtually useless. I have the MySQL driver setup in as a USER DSN. The MySQL data is sitting out on a server and the Access database is running locally. The network connection is very...
5
10328
by: krystoffff | last post by:
I currently have PostgreSQL 7.1 installed on a server with about 700 Mb of RAM. I have many problems of speed with a database I created. For example, it took almost 12 sec to run the query "select * from table" directly from PostgreSQL, on a table with 4000 records and 60 fields ... And the whole application built on this database is very very slow (some pages take almost 20 seconds to load !) I verifed the indexes, I think they are...
4
5483
by: DotNetJunky | last post by:
I have built a control that runs an on-line help system. Depending on the category you selected via dropdownlist, it goes out and gets the child subcategories, and if there are any, adds a new dropdownlist to the screen for selection. This continues until there are no children, and then it checks for a help article list based on that last selection and displays actual articles for display. Adding the controls and getting everything...
3
4887
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that the best method? Do you have a sample of how to do this?
29
2136
by: Geoff Jones | last post by:
Hi All I hope you'll forgive me for posting this here (I've also posted to ado site but with no response so far) as I'm urgently after a solution. Can anybody help me? I'm updating a table on a database i.e. I've modified the table in a DataSet and I want to update it to the SQL database which the table originally came from. I'm using a data adaptor and the update command and it works BUT it is soooooooooo slow!!! Can anybody tell me...
3
1964
by: michael | last post by:
Hi, I am trying to write an ASP.NET web app, in Visual Basic.NET, using Visual Studio.NET 2004, .NET framework 1.1.4322 SP1 Running the project/app on localhost while in dev/write/debug stage When I say "trying", I do have it written, and it works ... sort of, for some cases. The problems/issues?
2
3979
by: mavrick_101 | last post by:
Hi, I have a nested repeater. For each row in the parent repeater there is a child repeater with several rows of data. The way I'm doing this is throught ItemDataBound Event. So for each Row in parent repeater, when its ItemDataBound event is raised I grab the content of the child repeater and DataBind it. This makes the page load slower if there is more data.
12
4417
by: MGM | last post by:
Hey everyone, I'm having some issues here. I have a large Access .mdb (over 400,000 rows). What I need to do is, there are 12 columns that need to be reordered (quite literally as simple as if it is XZY, change to XYZ, but the row next to it must ALSO be changed accordingly, as in, WEC to WCE ). Anyways, when counting all of the rows that have the above mistake, there are nearly 300,000 rows affected. I need to write a quick program or...
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10246
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
10209
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,...
0
9066
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6803
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
5459
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
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4135
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
3750
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.