Export (0) Print
Expand All

DataSet.WriteXmlSchema Method (String)

.NET Framework 1.1

Writes the DataSet structure as an XML schema to a file.

[Visual Basic]
Overloads Public Sub WriteXmlSchema( _
   ByVal fileName As String _
)
[C#]
public void WriteXmlSchema(
 string fileName
);
[C++]
public: void WriteXmlSchema(
 String* fileName
);
[JScript]
public function WriteXmlSchema(
   fileName : String
);

Parameters

fileName
The file name (including the path) to which to write.

Exceptions

Exception Type Condition
SecurityException FileIOPermission is not set to Write.

Remarks

Use the WriteXmlSchema method to write the schema for a DataSet to an XML document. The schema includes table, relation, and constraint definitions. To write a schema to an XML document, use the WriteXmlSchema method.

The XML schema is written using the XSD standard.

To write the data to an XML document, use the WriteXml method.

Example

[Visual Basic] 
Private Sub WriteSchemaToFile(thisDataSet As DataSet)
    ' Set the file path and name. Modify this for your purposes.
    Dim filename As String = "mySchema.xml"
    ' Write the schema to the file.
    thisDataSet.WriteXmlSchema(filename)
End Sub

[C#] 
private void WriteSchemaToFile(DataSet thisDataSet){
   // Set the file path and name. Modify this for your purposes.
   string filename="mySchema.xml";
   // Write the schema to the file.
   thisDataSet.WriteXmlSchema(filename);
}

[C++] 
private:
 void WriteSchemaToFile(DataSet* thisDataSet){
    // Set the file path and name. Modify this for your purposes.
    String* filename=S"mySchema.xml";
    // Write the schema to the file.
    thisDataSet->WriteXmlSchema(filename);
 }

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

.NET Framework Security: 

See Also

DataSet Class | DataSet Members | System.Data Namespace | DataSet.WriteXmlSchema Overload List | ReadXml | ReadXmlSchema | WriteXml

Show:
© 2014 Microsoft