.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 >> Forum >> C# >> Post New QuestionBookmark and Share Subscribe to Forum

How to load the xml data into the DataSet using c#

Posted By: Deco     Posted Date: September 22, 2010    Points:2   Category :C#
Please give me the code to read an xml file into the Dataset.

Responses
Author: Ramesh durai             
Posted Date: September 23, 2010     Points: 5   



Hi,It's very simple

function redxml()
{
XmlReader Xmlfile;
Xmlfile= XmlReader.Create("<xmlfilepath>,new XmlReaderSettings());
Dataset oDs=new Dataset();
oDS.ReadXml(<xmlfile>);
}


replace <xmlfilepath> WITH yOUR FILE PATH

replace <xmlfile> WITH yOUR FILE NAME

Ramesh durai
Author: Akhil Raj       [Moderator]      
Posted Date: September 29, 2010     Points: 5   
Author: Santosh             
Posted Date: October 05, 2010     Points: 5   

check below Code:


DataSet ds1 = new DataSet();
ds1.ReadXml(System.Configuration.ConfigurationManager.AppSettings("xmlpath") + "Months.xml");
cmbMonth.ValueMember = "Id";
cmbMonth.DisplayMember = "Name";
cmbMonth.DataSource = ds1.Tables(0);


Regards
Santosh



Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

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