At firstly I am fill to datagrid manually and save as Xml ,folowing this code,But if I fill to multiple rows in datagrid and then only export last rows
Java
for (int i = 0; i < dataGridView1.Rows.Count; i++)
{
XmlTextWriter xmlDocument = new XmlTextWriter(@"d:\Deneme.xml", System.Text.Encoding.GetEncoding("ISO-8859-9"));
xmlDocument.Formatting = Formatting.Indented;
xmlDocument.Indentation = 5;
try
{
xmlDocument.WriteStartDocument();
xmlDocument.WriteStartElement("SALES_INVOICES");
xmlDocument.WriteElementString("TYPE", dataGridView1.Rows[i].Cells[0].Value.ToString());
xmlDocument.WriteEndElement();
xmlDocument.Close();
MessageBox.Show("Xml Created.");
}
catch (Exception ex)
{
MessageBox.Show("Hata" + ex.Message);
} }
And Result is
And Result is
<?xml version="1.0" encoding="iso-8859-9"?>
<SALES_INVOICES>
<TYPE>1453</TYPE>
</SALES_INVOICES>
I want to result is ;
</SALES_INVOICES>
Thanks in advance
I want to result is ;
<?xml version="1.0" encoding="iso-8859-9"?>
<SALES_INVOICES>
<TYPE>1452</TYPE>
</SALES_INVOICES>
<TYPE>1453</TYPE></SALES_INVOICES>
Thanks in advance
Umesh Kumar122 pointsPosted May 18, 2014, 10:47 AM EDT
Use Below Code
Demir Acar73 pointsPosted May 18, 2014, 10:56 AM EDT
Umesh Kumar122 pointsPosted May 19, 2014, 5:22 AM EDT