I’ve the following code:
Public Class Form1
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim cnn As New SqlConnection("Server=test;uid=sa;pwd=1234;database=empatic")
Dim da As New SqlDataAdapter("select * from producte for xml path('producte'), root('Productes')", cnn)
Dim ds As New DataSet
da.Fill(ds)
DataGridView1.DataSource = ds.Tables(0)
Dim a As String = ds.Tables(0).Rows(0).Item(0).ToString
Dim x = XDocument.Parse(a)
Dim s = x.ToString()
TextBoxXml.Text = s
End Sub
End Class
What does this code display the contents of the SQL text in a Frame. What I would like now is to create another button then click when I generate an XML file with the contents listed in the Frame text.
System.IO.File.WriteAllText("c:\temp\someXml.xml", TextBoxXml.Text)