I try to write an xml file from a datatable.
for (int i = 0; i < ValToAppendDt.Count; i++)
{
DataRow row = ResultDT.NewRow();
row[i] = ValToAppendDt[i].ToString();
ResultDT.Rows.Add(row);
}
ResultDT.WriteXml(@"\\blabla\" + Environment.MachineName + ".xml");
This results in this xml file:
<?xml version="1.0" standalone="yes"?>
<DocumentElement>
<ResultsTable>
<PC_Name>blabla</PC_Name>
</ResultsTable>
<ResultsTable>
<PC_Network_Card>blabla</PC_Network_Card>
</ResultsTable>
<ResultsTable>
<PC_Mac>blabla</PC_Mac>
</ResultsTable>
</DocumentElement>
So when I try to import this into excel, the first value appears in A1, the second in B2, third in C3…
I’d like to have them in A1, B1, C1… But I can’t fiind a way
I was mystaking in my for Loop…
I changed it to :
working fine now…