System.Data Namespace DataSet Class
Reads the XML schema from the specified Stream into the DataSet.
[ VB ]
Overloads Public Sub ReadXmlSchema ( _
ByVal stream As Stream _
)
[ C# ]
public void ReadXmlSchema (
Stream stream
);
[ C++ ]
public: void ReadXmlSchema (
Stream* stream
);
[ JScript ]
public function ReadXmlSchema (
stream : Stream
)
- stream
- The Stream from which to read.
Use the ReadXmlSchema method to create the schema for a DataSet. 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.
The ReadXmlSchema method is generally invoked before invoking the ReadXml method which is used to fill the DataSet.
The following shows an example of using this version of ReadXmlSchema.
private void ReadSchemaFromFileStream ( 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, and set to open the file.
System.IO.FileStream myFileStream =
new System.IO.FileStream ( filename,System.IO.FileMode.Open );
// Read the schema into the DataSet.
thisDataSet.ReadXmlSchema ( myFileStream );
// close the FileStream.
myFileStream.Close ( );
}
Private Sub ReadSchemaFromFileStream ( 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, and set to open the file
Dim myFileStream As New System.IO.FileStream _
( filename, System.IO.FileMode.Open )
' Read the schema into the DataSet.
thisDataSet.ReadXmlSchema ( myFileStream )
' Close the FileStream.
myFileStream.Close ( )
End Sub |
|
C# |
VB |
DataSet Members DataSet.ReadXmlSchema Overload List ReadXml WriteXml WriteXmlSchema