DataSet.WriteXmlSchema 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
寫入 DataSet 結構做為 XML 結構描述。
多載
WriteXmlSchema(String, Converter<Type,String>) |
將 DataSet 結構做為 XML 結構描述寫入檔案。 |
WriteXmlSchema(Stream) | |
WriteXmlSchema(TextWriter) |
將 DataSet 結構做為 XML 結構描述寫入指定的 TextWriter 物件。 |
WriteXmlSchema(String) |
將 DataSet 結構做為 XML 結構描述寫入檔案。 |
WriteXmlSchema(XmlWriter) | |
WriteXmlSchema(Stream, Converter<Type,String>) | |
WriteXmlSchema(TextWriter, Converter<Type,String>) |
將 DataSet 結構當做 XML 結構描述寫入至指定的 TextWriter。 |
WriteXmlSchema(XmlWriter, Converter<Type,String>) |
WriteXmlSchema(String, Converter<Type,String>)
- 來源:
- DataSet.cs
- 來源:
- DataSet.cs
- 來源:
- DataSet.cs
將 DataSet 結構做為 XML 結構描述寫入檔案。
public:
void WriteXmlSchema(System::String ^ fileName, Converter<Type ^, System::String ^> ^ multipleTargetConverter);
public void WriteXmlSchema (string fileName, Converter<Type,string> multipleTargetConverter);
member this.WriteXmlSchema : string * Converter<Type, string> -> unit
Public Sub WriteXmlSchema (fileName As String, multipleTargetConverter As Converter(Of Type, String))
參數
- fileName
- String
要寫入的檔案名稱。
適用於
WriteXmlSchema(Stream)
- 來源:
- DataSet.cs
- 來源:
- DataSet.cs
- 來源:
- DataSet.cs
public:
void WriteXmlSchema(System::IO::Stream ^ stream);
public void WriteXmlSchema (System.IO.Stream? stream);
public void WriteXmlSchema (System.IO.Stream stream);
member this.WriteXmlSchema : System.IO.Stream -> unit
Public Sub WriteXmlSchema (stream As Stream)
參數
範例
下列範例會建立傳遞至 WriteXmlSchema 方法的新 FileStream 物件,以將架構寫入磁碟。
private void WriteSchemaWithFileStream(DataSet thisDataSet)
{
// Set the file path and name. Modify this for your purposes.
string filename="Schema.xml";
// Create the FileStream object with the file name.
// Use FileMode.Create.
System.IO.FileStream stream =
new System.IO.FileStream(filename,System.IO.FileMode.Create);
// Write the schema to the file.
thisDataSet.WriteXmlSchema(stream);
// Close the FileStream.
stream.Close();
}
Private Sub WriteSchemaWithFileStream(thisDataSet As DataSet)
' Set the file path and name. Modify this for your purposes.
Dim filename As String = "Schema.xml"
' Create the FileStream object with the file name.
' Use FileMode.Create.
Dim stream As New System.IO.FileStream _
(filename, System.IO.FileMode.Create)
' Write the schema to the file.
thisDataSet.WriteXmlSchema(stream)
' Close the FileStream.
stream.Close()
End Sub
備註
WriteXmlSchema使用方法,將的DataSet架構寫入 XML 檔。 架構包含數據表、關聯性和條件約束定義。 若要將架構寫入 XML 檔,請使用 WriteXmlSchema 方法。
XML 架構是使用 XSD 標準撰寫的。
若要將數據寫入 XML 檔,請使用 WriteXml 方法。
衍生自類別的 Stream 類別包括 BufferedStream、 FileStream、 MemoryStream和 NetworkStream。
另請參閱
適用於
WriteXmlSchema(TextWriter)
- 來源:
- DataSet.cs
- 來源:
- DataSet.cs
- 來源:
- DataSet.cs
將 DataSet 結構做為 XML 結構描述寫入指定的 TextWriter 物件。
public:
void WriteXmlSchema(System::IO::TextWriter ^ writer);
public void WriteXmlSchema (System.IO.TextWriter? writer);
public void WriteXmlSchema (System.IO.TextWriter writer);
member this.WriteXmlSchema : System.IO.TextWriter -> unit
Public Sub WriteXmlSchema (writer As TextWriter)
參數
- writer
- TextWriter
用來寫入的 TextWriter 物件。
範例
下列範例會 System.Text.StringBuilder 建立 用來建立新 System.IO.StringWriter的物件。 會 StringWriter 傳遞至 WriteXmlSchema 方法,並將產生的字串列印至主控台視窗。
private void WriteSchemaWithStringWriter(DataSet thisDataSet)
{
// Create a new StringBuilder object.
System.Text.StringBuilder builder = new System.Text.StringBuilder();
// Create the StringWriter object with the StringBuilder object.
System.IO.StringWriter writer = new System.IO.StringWriter(builder);
// Write the schema into the StringWriter.
thisDataSet.WriteXmlSchema(writer);
// Print the string to the console window.
Console.WriteLine(writer.ToString());
}
Private Sub WriteSchemaWithStringWriter(thisDataSet As DataSet)
' Create a new StringBuilder object.
Dim builder As New System.Text.StringBuilder()
' Create the StringWriter object with the StringBuilder object.
Dim writer As New System.IO.StringWriter(builder)
' Write the schema into the StringWriter.
thisDataSet.WriteXmlSchema(writer)
' Print the string to the console window.
Console.WriteLine(writer.ToString())
End Sub
備註
WriteXmlSchema使用方法,將的DataSet架構寫入 XML 檔。 架構包含數據表、關聯性和條件約束定義。 若要將架構寫入 XML 檔,請使用 WriteXmlSchema 方法。
XML 架構是使用 XSD 標準撰寫的。
若要將數據寫入 XML 檔,請使用 WriteXml 方法。
衍生自類別的 System.IO.TextWriter 類別包括 System.Web.HttpWriter、 System.CodeDom.Compiler.IndentedTextWriter、 System.Web.UI.HtmlTextWriter、 System.IO.StreamWriter和 System.IO.StringWriter。
另請參閱
適用於
WriteXmlSchema(String)
- 來源:
- DataSet.cs
- 來源:
- DataSet.cs
- 來源:
- DataSet.cs
將 DataSet 結構做為 XML 結構描述寫入檔案。
public:
void WriteXmlSchema(System::String ^ fileName);
public void WriteXmlSchema (string fileName);
member this.WriteXmlSchema : string -> unit
Public Sub WriteXmlSchema (fileName As String)
參數
- fileName
- String
要寫入的目的檔案名稱 (包括路徑)。
例外狀況
FileIOPermission 並不是設定為 Write。
範例
private void WriteSchemaToFile(DataSet thisDataSet)
{
// Set the file path and name. Modify this for your purposes.
string filename="Schema.xml";
// Write the schema to the file.
thisDataSet.WriteXmlSchema(filename);
}
Private Sub WriteSchemaToFile(thisDataSet As DataSet)
' Set the file path and name. Modify this for your purposes.
Dim filename As String = "Schema.xml"
' Write the schema to the file.
thisDataSet.WriteXmlSchema(filename)
End Sub
備註
WriteXmlSchema使用方法,將的DataSet架構寫入 XML 檔。 架構包含數據表、關聯性和條件約束定義。 若要將架構寫入 XML 檔,請使用 WriteXmlSchema 方法。
XML 架構是使用 XSD 標準撰寫的。
若要將數據寫入 XML 檔,請使用 WriteXml 方法。
另請參閱
適用於
WriteXmlSchema(XmlWriter)
- 來源:
- DataSet.cs
- 來源:
- DataSet.cs
- 來源:
- DataSet.cs
public:
void WriteXmlSchema(System::Xml::XmlWriter ^ writer);
public void WriteXmlSchema (System.Xml.XmlWriter? writer);
public void WriteXmlSchema (System.Xml.XmlWriter writer);
member this.WriteXmlSchema : System.Xml.XmlWriter -> unit
Public Sub WriteXmlSchema (writer As XmlWriter)
參數
範例
下列範例會建立具有指定路徑的新 System.IO.FileStream 物件。 對像是 FileStream 用來建立 XmlTextWriter 物件。 WriteXmlSchema接著會使用 物件叫用 方法,XmlTextWriter以將架構寫入磁碟。
private void WriteSchemaWithXmlTextWriter(DataSet thisDataSet)
{
// Set the file path and name. Modify this for your purposes.
string filename="SchemaDoc.xml";
// Create a FileStream object with the file path and name.
System.IO.FileStream stream = new System.IO.FileStream
(filename,System.IO.FileMode.Create);
// Create a new XmlTextWriter object with the FileStream.
System.Xml.XmlTextWriter writer =
new System.Xml.XmlTextWriter(stream,
System.Text.Encoding.Unicode);
// Write the schema into the DataSet and close the reader.
thisDataSet.WriteXmlSchema(writer );
writer.Close();
}
Private Sub WriteSchemaWithXmlTextWriter(thisDataSet As DataSet)
' Set the file path and name. Modify this for your purposes.
Dim filename As String = "SchemaDoc.xml"
' Create a FileStream object with the file path and name.
Dim stream As New System.IO.FileStream _
(filename, System.IO.FileMode.Create)
' Create a new XmlTextWriter object with the FileStream.
Dim writer As New System.Xml.XmlTextWriter _
(stream, System.Text.Encoding.Unicode)
' Write the schema into the DataSet and close the reader.
thisDataSet.WriteXmlSchema(writer)
writer.Close()
End Sub
備註
WriteXmlSchema使用方法,將的DataSet架構寫入 XML 檔。 架構包含數據表、關聯性和條件約束定義。 若要將架構寫入 XML 檔,請使用 WriteXmlSchema 方法。
XML 架構是使用 XSD 標準撰寫的。
若要將數據寫入 XML 檔,請使用 WriteXml 方法。
繼承自類別的 System.Xml.XmlWriter 一個類別是 XmlTextWriter 類別。
另請參閱
適用於
WriteXmlSchema(Stream, Converter<Type,String>)
- 來源:
- DataSet.cs
- 來源:
- DataSet.cs
- 來源:
- DataSet.cs
public:
void WriteXmlSchema(System::IO::Stream ^ stream, Converter<Type ^, System::String ^> ^ multipleTargetConverter);
public void WriteXmlSchema (System.IO.Stream? stream, Converter<Type,string> multipleTargetConverter);
public void WriteXmlSchema (System.IO.Stream stream, Converter<Type,string> multipleTargetConverter);
member this.WriteXmlSchema : System.IO.Stream * Converter<Type, string> -> unit
Public Sub WriteXmlSchema (stream As Stream, multipleTargetConverter As Converter(Of Type, String))
參數
適用於
WriteXmlSchema(TextWriter, Converter<Type,String>)
- 來源:
- DataSet.cs
- 來源:
- DataSet.cs
- 來源:
- DataSet.cs
將 DataSet 結構當做 XML 結構描述寫入至指定的 TextWriter。
public:
void WriteXmlSchema(System::IO::TextWriter ^ writer, Converter<Type ^, System::String ^> ^ multipleTargetConverter);
public void WriteXmlSchema (System.IO.TextWriter? writer, Converter<Type,string> multipleTargetConverter);
public void WriteXmlSchema (System.IO.TextWriter writer, Converter<Type,string> multipleTargetConverter);
member this.WriteXmlSchema : System.IO.TextWriter * Converter<Type, string> -> unit
Public Sub WriteXmlSchema (writer As TextWriter, multipleTargetConverter As Converter(Of Type, String))
參數
- writer
- TextWriter
要寫入的目標 TextWriter 物件。
適用於
WriteXmlSchema(XmlWriter, Converter<Type,String>)
- 來源:
- DataSet.cs
- 來源:
- DataSet.cs
- 來源:
- DataSet.cs
public:
void WriteXmlSchema(System::Xml::XmlWriter ^ writer, Converter<Type ^, System::String ^> ^ multipleTargetConverter);
public void WriteXmlSchema (System.Xml.XmlWriter? writer, Converter<Type,string> multipleTargetConverter);
public void WriteXmlSchema (System.Xml.XmlWriter writer, Converter<Type,string> multipleTargetConverter);
member this.WriteXmlSchema : System.Xml.XmlWriter * Converter<Type, string> -> unit
Public Sub WriteXmlSchema (writer As XmlWriter, multipleTargetConverter As Converter(Of Type, String))