Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

c# XML file best approach

Posted on 2011-09-15
4
Medium Priority
?
265 Views
Last Modified: 2012-05-12
HI,

I have made an c# app that gets data from a database and creates an XML file and puts the data in that XML file.

I want to know whats the best/fastest approach to take as there can be over 10,000-20,000 records to take at once.

Thanks,

R8VI
0
Comment
Question by:R8VI
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 27

Accepted Solution

by:
Shaun Kline earned 2000 total points
ID: 36545833
If you do not need to manipulate the data (such as column names) when the XML file is created, consider using the WriteXML method on the data table object: http://msdn.microsoft.com/en-us/library/system.data.datatable.aspx
0
 
LVL 16

Expert Comment

by:Easwaran Paramasivam
ID: 36547251
Yes. Above said is correct one. We have one more option.

From the sql itself you can return XML as output. Just write the output in a XML file.
http://msdn.microsoft.com/en-us/library/ms178107.aspx

Explicit option will allow to specify your xml format. You have control on the format that you need.
0
 
LVL 16

Expert Comment

by:Easwaran Paramasivam
ID: 36547253
0
 
LVL 2

Expert Comment

by:i0nutz
ID: 36549035

You should get the XML from the DB and then do Streaming read of a such large XML file.
Please see this link where you have a sample code for this:
http://stackoverflow.com/questions/45481/how-to-do-streaming-read-of-a-large-xml-file

Hope this will help you.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question