Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

DataTable.WriteXml Method

Writes the current contents of the DataTable as XML.

Name Description
DataTable.WriteXml (Stream) Writes the current contents of the DataTable as XML using the specified Stream.

Supported by the .NET Compact Framework.

DataTable.WriteXml (String) Writes the current contents of the DataTable as XML using the specified file.

Supported by the .NET Compact Framework.

DataTable.WriteXml (TextWriter) Writes the current contents of the DataTable as XML using the specified TextWriter.

Supported by the .NET Compact Framework.

DataTable.WriteXml (XmlWriter) Writes the current contents of the DataTable as XML using the specified XmlWriter.

Supported by the .NET Compact Framework.

DataTable.WriteXml (Stream, Boolean) Writes the current contents of the DataTable as XML using the specified Stream. To save the data for the table and all its descendants, set the writeHierarchy parameter to true.

Supported by the .NET Compact Framework.

DataTable.WriteXml (Stream, XmlWriteMode) Writes the current data, and optionally the schema, for the DataTable to the specified file using the specified XmlWriteMode. To write the schema, set the value for the mode parameter to WriteSchema.

Supported by the .NET Compact Framework.

DataTable.WriteXml (String, Boolean) Writes the current contents of the DataTable as XML using the specified file. To save the data for the table and all its descendants, set the writeHierarchy parameter to true.

Supported by the .NET Compact Framework.

DataTable.WriteXml (String, XmlWriteMode) Writes the current data, and optionally the schema, for the DataTable using the specified file and XmlWriteMode. To write the schema, set the value for the mode parameter to WriteSchema.

Supported by the .NET Compact Framework.

DataTable.WriteXml (TextWriter, Boolean) Writes the current contents of the DataTable as XML using the specified TextWriter. To save the data for the table and all its descendants, set the writeHierarchy parameter to true.

Supported by the .NET Compact Framework.

DataTable.WriteXml (TextWriter, XmlWriteMode) Writes the current data, and optionally the schema, for the DataTable using the specified TextWriter and XmlWriteMode. To write the schema, set the value for the mode parameter to WriteSchema.

Supported by the .NET Compact Framework.

DataTable.WriteXml (XmlWriter, Boolean) Writes the current contents of the DataTable as XML using the specified XmlWriter.

Supported by the .NET Compact Framework.

DataTable.WriteXml (XmlWriter, XmlWriteMode) Writes the current data, and optionally the schema, for the DataTable using the specified XmlWriter and XmlWriteMode. To write the schema, set the value for the mode parameter to WriteSchema.

Supported by the .NET Compact Framework.

DataTable.WriteXml (Stream, XmlWriteMode, Boolean) Writes the current data, and optionally the schema, for the DataTable to the specified file using the specified XmlWriteMode. To write the schema, set the value for the mode parameter to WriteSchema. To save the data for the table and all its descendants, set the writeHierarchy parameter to true.

Supported by the .NET Compact Framework.

DataTable.WriteXml (String, XmlWriteMode, Boolean) Writes the current data, and optionally the schema, for the DataTable using the specified file and XmlWriteMode. To write the schema, set the value for the mode parameter to WriteSchema. To save the data for the table and all its descendants, set the writeHierarchy parameter to true.

Supported by the .NET Compact Framework.

DataTable.WriteXml (TextWriter, XmlWriteMode, Boolean) Writes the current data, and optionally the schema, for the DataTable using the specified TextWriter and XmlWriteMode. To write the schema, set the value for the mode parameter to WriteSchema. To save the data for the table and all its descendants, set the writeHierarchy parameter to true.

Supported by the .NET Compact Framework.

DataTable.WriteXml (XmlWriter, XmlWriteMode, Boolean) Writes the current data, and optionally the schema, for the DataTable using the specified XmlWriter and XmlWriteMode. To write the schema, set the value for the mode parameter to WriteSchema. To save the data for the table and all its descendants, set the writeHierarchy parameter to true.

Supported by the .NET Compact Framework.

The WriteXml method provides a way to write either data only, or both data and schema from a DataTable into an XML document, whereas the WriteXmlSchema method writes only the schema. To write both data and schema, use one of the overloads that include the XmlWriteMode parameter, and set its value to WriteSchema.

Note that the same is true for the ReadXml and ReadXmlSchema methods, respectively. To read XML data, or both schema and data into the DataTable, use the ReadXml method. To read just the schema, use the ReadXmlSchema method.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2015 Microsoft