gregurs Posted May 25, 2012 at 02:32 AM Report #458029 Posted May 25, 2012 at 02:32 AM (edited) Boa noite tenho este código para inserir dados numa tabela e tenho que criar um ficheiro XML dos dados inseridos, não tenho problemas em inserir dados na tabela o meu problema é criar o ficheiro, o código que tenho é : con = new System.Data.SqlClient.SqlConnection(); con.ConnectionString = @"Data Source = MAQUINA0\SQLEXPESS;Initial Catalog=Database;Integrated Security=True"; con.Open(); try { SqlCommand command = con.CreateCommand(); command.CommandText = "INSERT INTO Receitas VALUES (" + textBox1.Text + ",'" + textBox2.Text + "', '" + textBox3.Text + "', '" + textBox4.Text + "')"; command.CommandType = CommandType.Text; SqlDataReader reader = command.ExecuteReader(); reader.Close(); } catch (Exception er) { MessageBox.Show(er.ToString(), "Erro de ligação"); } Edited May 25, 2012 at 02:34 AM by gregurs
Gonka Posted May 25, 2012 at 09:01 AM Report #458038 Posted May 25, 2012 at 09:01 AM Por exemplo: http://csharp.net-informations.com/xml/how-to-create-xml.htm
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now