Creating XML file from Dataset Problem

Feb 18 2008 3:55 AM

I have the following code which is supposed to create an xml from a dataset but is not working. can you help me please.

If SaveFileDialog.ShowDialog = Windows.Forms.DialogResult.OK Then
            Try
                Dim MyFile As FileStream = New FileStream(SaveFileDialog.FileName, FileMode.Create)
                Dim NewFile As MemoryStream = New MemoryStream
    
                cheroDataset.WriteXml(NewFile)
                Dim NewData(NewFile.Length) As Byte
                NewFile.Read(NewData, 0, NewData.Length)
  
                MyFile.Write(NewData, 0, NewData.Length)

            Catch ex As Exception
                MsgBox(ex.Message)
            End Try
        End If


Answers (1)