0

I generate an xml file using a dataset as source

private void button_generate_Click(object sender, EventArgs e)
    {
        DataSet ds = new DataSet();
        DataTable dt = new DataTable();
        ds.DataSetName = "Something";
        ds.Namespace = "http://www.w3.org/2001/XMLSchema-instance";

        dt.TableName = "somethingElse";
        ds.Tables.Add(dt);
        ds.WriteXml(filename);
    }

and it gives me something like this:

<Something xmlns="http://www.w3.org/2001/XMLSchema-instance">
 <SomethingElse>
    <exerciceFiscalDu>01/01/2014</exerciceFiscalDu>
 </SomethingElse>
</Something>

but I want the datetime from the data table to be written in a specific format YYYY/MM/DD.

SMR
  • 6,628
  • 2
  • 35
  • 56
raz_user
  • 127
  • 1
  • 1
  • 9
  • What do you do with this XML? Do you pass it to SQL Server? – Sadique Feb 24 '15 at 12:04
  • try solution http://stackoverflow.com/questions/3209829/is-it-possible-to-format-a-date-column-of-a-datatable and then write to XML. – Amit Feb 24 '15 at 12:48
  • I don't know where the XML file ends up, I just send it to someone, what does it change if they are passing it to SQL Server – raz_user Feb 24 '15 at 14:03

0 Answers0