Jump to content

Recommended Posts

Posted

Preciso de ajuda num código que cria um ficheiro xml com os dados que tenho inserido na base dados

experimentei o seguinte código mas no ficheiro xml so aparece os dados de 1 empregado e precisava que aparecesse todos os empregados adicionados agradeço se alguém me puder ajudar

   XmlTextWriter xWriter = new XmlTextWriter("Empregados.xml", Encoding.UTF8);
		xWriter.WriteStartElement("Empregados");
		xWriter.WriteStartElement("Empregados");
		xWriter.WriteStartElement("nome");
		xWriter.WriteString(txtNome.Text);
		xWriter.WriteStartElement("Cargo");
		xWriter.WriteString(txtCargo.Text);
		xWriter.WriteStartElement("Telefone");
		xWriter.WriteString(comboBox1.Text);
		xWriter.WriteStartElement("Observaocao");
		xWriter.WriteString(txtObservacao.Text);
		xWriter.WriteEndElement();
		xWriter.WriteEndElement();
		xWriter.WriteEndElement();
		xWriter.Close();

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.