Solved

c# XML file best approach

Posted on 2011-09-15
4
253 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
  • 2
4 Comments
 
LVL 25

Accepted Solution

by:
Shaun Kline earned 500 total points
Comment Utility
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
Comment Utility
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
Comment Utility
0
 
LVL 2

Expert Comment

by:i0nutz
Comment Utility

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 improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now