> DataSet ds1 = ds.DataSet; // the original > > DataSet ds2 = ds1.Clone(); // cloned > > using (MemoryStream contents = new MemoryStream()) > { > ds1.WriteXml(contents); // save contents to a stream > contents.Position = 0; > ds2.ReadXml(contents); > } >Thanks, I tried that. But, it does not work. It is the same result. This does not create a copy.
' Clone this object Public Function Clone() As Object Implements System.ICloneable.Clone Dim loData As Data = DirectCast(MemberwiseClone(), Data) Dim loDataSet As DataSet = Nothing loDataSet = oDataSet.Clone Using loMemoryStream As System.IO.MemoryStream = New System.IO.MemoryStream oDataSet.WriteXml(loMemoryStream) loMemoryStream.Position = 0 loDataSet.ReadXml(loMemoryStream) End Using loData.oDataSet = loDataSet Return loData End Function