System.Data Namespace DataSet Class
Writes the DataSet structure as an XML schema using the specified Stream object.
[ VB ]
Overloads Public Sub WriteXmlSchema ( _
ByVal stream As Stream _
)
[ C# ]
public void WriteXmlSchema (
Stream stream
);
[ C++ ]
public: void WriteXmlSchema (
Stream* stream
);
[ JScript ]
public function WriteXmlSchema (
stream : Stream
);
- stream
- A Stream object used to write to a file.
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.
Classes that derive from the Stream class include BufferedStream, FileStream, MemoryStream, and NetworkStream.
The following example initializes a new FileStream object that is passed to the WriteXmlSchema method to write the schema to disk.
private void WriteSchemaWithFileStream ( DataSet thisDataSet ) {
// set the file path and name. Modify this for your purposes.
string filename = "mySchema.xml";
// create the FileStream object with the file name. Use FileMode.Create.
System.IO.FileStream myFileStream =
new System.IO.FileStream ( filename,System.IO.FileMode.Create );
// write the schema to the file.
thisDataSet.WriteXmlSchema ( myFileStream );
// close the FileStream.
myFileStream.Close ( );
}
Private Sub WriteSchemaWithFileStream ( thisDataSet As DataSet )
' set the file path and name. Modify this for your purposes.
Dim filename As String = "mySchema.xml"
' create the FileStream object with the file name. Use FileMode.Create.
Dim myFileStream As New System.IO.FileStream _
( filename, System.IO.FileMode.Create )
' write the schema to the file.
thisDataSet.WriteXmlSchema ( myFileStream )
' close the FileStream.
myFileStream.Close ( )
End Sub |
|
C# |
VB |
DataSet Members DataSet.WriteXmlSchema Overload List WriteXml ReadXml ReadXmlSchema