.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> ADO.NET >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

DataSet To Xml

Posted By:Syed Shakeer Hussain       Posted Date: August 11, 2009    Points: 10    Category: ADO.NET    URL: http://www.dotnetspark.com  
 

ADO.NET Native storage format is XML (Extensible Markup Language)

ADO Native storage format is ADTD (Advanced Data Table Gram)

The important difference between ado.net and ado was disconnected and connection oriented architecture all are know this one very well. In this following example how to easily convert dataset into xml file with in two line of code it very simple also.

According to me whenever you handle small amount of data go to following idea its working very good effect. If it's your database is huge do not apply these logic it acquire more memory.

SqlConnection sqlcon = new SqlConnection("server=localhost;database=veera;integrated security=SSPI");

sqlcon.Open();

SqlDataAdapter sqladap = new SqlDataAdapter("select * from Designation", sqlcon);

DataSet ds = new DataSet("Veera");

sqladap.Fill(ds,"Designation");

//load data from dataset to xmldatadocument

XmlDataDocument xmldoc = new XmlDataDocument(ds);

xmldoc.Save(Application.StartupPath + "\\mydsXml.xml");

 





     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend