DataSet.WriteXmlSchema 方法
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
写 XML 架构形式的 DataSet 结构。
WriteXmlSchema(String, Converter<Type,String>) |
将 XML 架构形式的 DataSet 结构写入文件。 |
WriteXmlSchema(Stream) | |
WriteXmlSchema(TextWriter) |
将 DataSet 结构作为 XML 架构写入指定的 TextWriter 对象。 |
WriteXmlSchema(String) |
将 XML 架构形式的 DataSet 结构写入文件。 |
WriteXmlSchema(XmlWriter) | |
WriteXmlSchema(Stream, Converter<Type,String>) | |
WriteXmlSchema(TextWriter, Converter<Type,String>) |
将 DataSet 结构作为一个 XML 架构写入指定的 TextWriter。 |
WriteXmlSchema(XmlWriter, Converter<Type,String>) |
- Source:
- DataSet.cs
- Source:
- DataSet.cs
- Source:
- DataSet.cs
将 XML 架构形式的 DataSet 结构写入文件。
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
要写入的文件的名称。
适用于
- Source:
- DataSet.cs
- Source:
- DataSet.cs
- Source:
- 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)
参数
示例
以下示例创建一个新的 FileStream 对象,该对象传递给 WriteXmlSchema 方法,以将架构写入磁盘。
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。
另请参阅
适用于
- Source:
- DataSet.cs
- Source:
- DataSet.cs
- Source:
- 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.HtmlTextWriterSystem.IO.StreamWriter和 System.IO.StringWriter。
另请参阅
适用于
- Source:
- DataSet.cs
- Source:
- DataSet.cs
- Source:
- DataSet.cs
将 XML 架构形式的 DataSet 结构写入文件。
public:
void WriteXmlSchema(System::String ^ fileName);
public void WriteXmlSchema (string fileName);
member this.WriteXmlSchema : string -> unit
Public Sub WriteXmlSchema (fileName As String)
参数
- fileName
- String
要向其写入的文件的名称(包括路径)。
例外
示例
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 方法。
另请参阅
适用于
- Source:
- DataSet.cs
- Source:
- DataSet.cs
- Source:
- 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 类。
另请参阅
适用于
- Source:
- DataSet.cs
- Source:
- DataSet.cs
- Source:
- 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))
参数
适用于
- Source:
- DataSet.cs
- Source:
- DataSet.cs
- Source:
- 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 对象。
适用于
- Source:
- DataSet.cs
- Source:
- DataSet.cs
- Source:
- 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))