DataSet.WriteXmlSchema メソッド (Stream)
指定した System.IO.Stream オブジェクトを使用して、 DataSet 構造体を XML スキーマとして書き込みます。
Overloads Public Sub WriteXmlSchema( _
ByVal stream As Stream _)
[C#]
public void WriteXmlSchema(Streamstream);
[C++]
public: void WriteXmlSchema(Stream* stream);
[JScript]
public function WriteXmlSchema(
stream : Stream);
パラメータ
- stream
ファイルに書き込むために使用する Stream オブジェクト。
解説
WriteXmlSchema メソッドを使用して、 DataSet のスキーマを XML ドキュメントに書き込みます。スキーマにはテーブル、リレーションシップ、制約の各定義が含まれています。XML ドキュメントにスキーマを書き込むには、 WriteXmlSchema メソッドを使用します。
XML スキーマの書き込みには、XSD 標準を使用します。
XML ドキュメントにデータを書き込むには、 WriteXml メソッドを使用します。
Stream クラスの派生クラスには、 BufferedStream 、 FileStream 、 MemoryStream 、および NetworkStream が含まれます。
使用例
[Visual Basic, C#, C++] WriteXmlSchema メソッドに渡してスキーマをディスクに書き込むための新しい FileStream オブジェクトを作成する例を次に示します。
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#]
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();
}
[C++]
private:
void WriteSchemaWithFileStream(DataSet* thisDataSet){
// Set the file path and name. Modify this for your purposes.
String* filename=S"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();
}
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ
参照
DataSet クラス | DataSet メンバ | System.Data 名前空間 | DataSet.WriteXmlSchema オーバーロードの一覧 | ReadXml | WriteXml