System.Data.DataSet.WriteXml Method

Writes the current data for the System.Data.DataSet using the specified System.IO.Stream.

Syntax

public void WriteXml (System.IO.Stream stream)

Parameters

stream
A System.IO.Stream object used to write to a file.

Remarks

The WriteXml method provides a way to write either data only, or both data and schema from a System.Data.DataSet into an XML document, whereas the DataSet.WriteXmlSchema(System.IO.Stream) method writes only the schema. To write both data and schema, use one of the overloads that includes the mode parameter, and set its value to WriteSchema.

Note that the same is true for the DataSet.ReadXml(System.Xml.XmlReader) and DataSet.ReadXmlSchema(System.Xml.XmlReader) methods, respectively. To read XML data, or both schema and data into the DataSet, use the ReadXml method. To read just the schema, use the ReadXmlSchema method.

Note:

An InvalidOperationException will be thrown if a column type in the DataRow being read from or written to implements System.Dynamic.IDynamicMetaObjectProvider and does not implement System.Xml.Serialization.IXmlSerializable.

Requirements

Namespace: System.Data
Assembly: System.Data (in System.Data.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0