Write an XML file inside Solucion C#

Asked

Viewed 76 times

0

Good evening Everyone,

I would like a help, the structure of my project is according to the image below.

Estrutura do Projeto

I would like to import data from my table to this 'Arq.xml' file that is inside the project.

I’m trying to do with this code:

     dt.WriteXml("arq.xml", XmlWriteMode.WriteSchema);
     MessageBox.Show("Dados Exportado com Sucesso");

But it is not writing, then when I put the fullname of another way, it works. But I wanted to save inside the project itself, so that the project has its own xml, without having anything external, I could understand?

  • this way you will write the file in the folder where the application is running...most likely in the folder debug... you can take the xml from the debug folder, put it in the Solution folder and add it in the Solution, just click on the 8th icon of the Solution explorer, and then on include... but it doesn’t make much sense what you want... maybe explain the purpose of it, we can help in a better way

  • It’s for educational purposes..., but even so, I didn’t understand your approach, could you explain it to me better, please, please

  • 1

    you have a Datatable, and you want to export it to an xml file... when you run the dt.WriteXml("arq.xml", XmlWriteMode.WriteSchema); it will write the file in the folder in which the application is running... just take the file there and put in the folder of Solution. All right it’s for educational purposes, but what’s the point of having the DataTable xml in the Solution folder ?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.