Questo articolo è stato tradotto automaticamente. Per visualizzare l'articolo in inglese, selezionare la casella di controllo Inglese. È possibile anche visualizzare il testo inglese in una finestra popup posizionando il puntatore del mouse sopra il testo.
Traduzione
Inglese

Metodo DataSet.WriteXmlSchema (TextWriter)

 

Data di pubblicazione: ottobre 2016

Scrive la struttura DataSet come schema XML nell'oggetto TextWriter specificato.

Spazio dei nomi:   System.Data
Assembly:  System.Data (in System.Data.dll)

public void WriteXmlSchema(
	TextWriter writer
)

Parametri

writer
Type: System.IO.TextWriter

Oggetto TextWriter con cui eseguire operazioni di scrittura.

Use the M:System.Data.DataSet.WriteXmlSchema(System.IO.Stream) method to write the schema for a T:System.Data.DataSet to an XML document. The schema includes table, relation, and constraint definitions. To write a schema to an XML document, use the M:System.Data.DataSet.WriteXmlSchema(System.IO.Stream) method.

The XML schema is written using the XSD standard.

To write the data to an XML document, use the M:System.Data.DataSet.WriteXml(System.IO.Stream) method.

Classes the derive from the T:System.IO.TextWriter class include the T:System.Web.HttpWriter, T:System.CodeDom.Compiler.IndentedTextWriter, T:System.Web.UI.HtmlTextWriter, T:System.IO.StreamWriter, and T:System.IO.StringWriter.

The following example creates a T:System.Text.StringBuilder object to that is used to create a new T:System.IO.StringWriter. The T:System.IO.StringWriter is passed to the M:System.Data.DataSet.WriteXmlSchema(System.IO.Stream) method, and the resulting string is printed to the console window.

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());
}

.NET Framework
Disponibile da 1.1
Torna all'inizio
Mostra: