Click here to Skip to main content
15,913,722 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Here this is my Code



C#
LoginDetails objLogin = (LoginDetails)Session["LoginDetils"];
                int _BranchID = Convert.ToInt32(objLogin.BranchID.ToString());
                int _FinancialyearID = Convert.ToInt32(objLogin.FinancialyearID.ToString());
                int _WarehouseID = Convert.ToInt32(objLogin.WarehouseID.ToString());
                DateTime Date = Convert.ToDateTime(txtDate.SelectedDate);
                Dashboard objInvSalesDashboard = new Dashboard();
                DataSet Ds = new DataSet();

                Ds = objInvSalesDashboard.DailyPurchaseReport(_FinancialyearID, _BranchID, _WarehouseID, Date);
                StreamWriter xmlDoc = new StreamWriter(Server.MapPath("~/images/Testdo.xml"), false);
                Ds.WriteXml(xmlDoc);
                xmlDoc.Close();


                string strFullPath = Server.MapPath("~/images/Testdo.xml");
                string strContents = null;
                System.IO.StreamReader objReader = default(System.IO.StreamReader);
                objReader = new System.IO.StreamReader(strFullPath);
                strContents = objReader.ReadToEnd();
                objReader.Close();

                string attachment = "attachment; filename=test.xml";
                Response.ClearContent();
                Response.ContentType = "application/xml";
                Response.AddHeader("content-disposition", attachment);
                Response.Write(strContents);
                Response.End();


Here Iam getting the Out Put Like This


HTML
<NewDataSet>
<Table>
 <Date>07/01/2012</Date>
 <Billno>27</Billno>
 <PatientName>v1</PatientName>
 <ItemName>PB32 POWERBOR MACHINE - 240V</ItemName>
 <BillAmount>1000.000000</BillAmount>
 </Table>
<Table>
 <Date>07/01/2012</Date>
 <Billno>27</Billno>
 <PatientName>v1</PatientName>
 <ItemName>PB32 POWERBOR MACHINE - 240V</ItemName>
 <BillAmount>600.000000</BillAmount>
 </Table>
 </NewDataSet>



so here for BillNo 27 its Repeating

i need the output to be like this


HTML
<NewDataSet>
 <Table>
  <Billno=27  Date=07/01/2012  PatientName=v1> 
 
  <ItemName>PB32 POWERBOR MACHINE - 240V</ItemName> 
  <BillAmount>1000.000000</BillAmount> 
  <ItemName>PB32 POWERBOR MACHINE - 240V</ItemName> 
  <BillAmount>600.000000</BillAmount> 
 </Billno>

</NewDataSet>
 </Table>
Posted
Updated 28-Mar-13 20:11pm
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900