sachinpramod Report post Posted July 15, 2008 (edited) hi i am facing a problem.. the thing is that i have to populate the xml form datset based on the dataset values.How to add the root element and child elmets according to tht here is my code.. pls help me out protected void Button1_Click(object sender, EventArgs e) { strXML =; strXML+= ""; strXML += ""; strXML += ""; strXML += ""; strXML += ""; strXML += ""; strXML += ""; SqlDataAdapter da = new SqlDataAdapter("select * from Test_Gantt", con); DataSet ds = new DataSet(); da.Fill(ds, "ds"); //Iterate through each Record foreach (DataRow dr in ds.Tables[0].Rows) { strXML += ""; } con.Close(); strXML += ""; strXML += ""; FileStream fs = new FileStream(Server.MapPath("My_ Xml_ Files/emp6.xml"), FileMode.Create); fs.Write(strXML); } code.txt Edited July 15, 2008 by Guest Share this post Link to post Share on other sites
Pallav Report post Posted July 21, 2008 You can iterate through the dataset and then use string concatenation to build XML. Please see www.fusioncharts.com/docs > Guide for web developers. Share this post Link to post Share on other sites
ajberry Report post Posted January 27, 2009 (edited) Basically its: For (int i = 0; i < ds.Tables[0].rows.count; i++) { strxml+= < set name= ds.Tables[0].rows[column number of name].toString(), value= ds.Tables[0].rows[column number of value].toString() / > } Edited January 27, 2009 by Guest Share this post Link to post Share on other sites
Reddy Report post Posted July 20, 2009 strXML += "<categories>";while (oRs.ReadData.Read()) { strXML += "<category name='" + oRs.ReadData["Day Name"].ToString() + "' />";} strXML += "</categories>"; Use the XML tag which you want instead of categories. Share this post Link to post Share on other sites
Reddy Report post Posted July 20, 2009 strXML += "<categories>"; while (oRs.ReadData.Read()){ strXML += "<category name='" + oRs.ReadData["Day Name"].ToString() + "' />";} strXML += "</categories>"; use the Required XML tag instead of categories Share this post Link to post Share on other sites