• How to export DataTable to XML in C#

    by  • May 22, 2013 • Microsoft .NET C# (C-Sharp), Microsoft ASP.NET • 0 Comments

    Sometimes we need to export our DataSet or DataTable data to XML file. ASP.NET provides a simple WriteXml() method of DataTable or DataSet class. This method simply writes DataTable or DataSet data to the specified file. You can also achieve this by using StreamWriter class object with WriteXml() method of DataTable or DataSet class.

    Let’s see how we can do it. You can also download sample code at the bottom of the article.

    Don’t forget to use following namespaces in your code as these are necessary.




    Namecheap.com
    Avatar of GetCodeSnippet.com

    About

    GetCodeSnippet.com provides you high quality Microsoft .NET development related articles, tutorials and sample code for ASP.NET, C#, VB.NET, AJAX, WCF, WPF, Web Services, Windows Services, SQL Server and other technologies.

    Leave a Reply