DataSet.GetXmlSchema Yöntem
Tanım
Önemli
Bazı bilgiler ürünün ön sürümüyle ilgilidir ve sürüm öncesinde önemli değişiklikler yapılmış olabilir. Burada verilen bilgilerle ilgili olarak Microsoft açık veya zımni hiçbir garanti vermez.
içinde depolanan verilerin XML gösterimi için XML Şemasını DataSetdöndürür.
public:
System::String ^ GetXmlSchema();
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Members from serialized types may use dynamic code generation.")]
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly.")]
public string GetXmlSchema();
public string GetXmlSchema();
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly.")]
public string GetXmlSchema();
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Members from serialized types may use dynamic code generation.")>]
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly.")>]
member this.GetXmlSchema : unit -> string
member this.GetXmlSchema : unit -> string
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Members from serialized types may be trimmed if not referenced directly.")>]
member this.GetXmlSchema : unit -> string
Public Function GetXmlSchema () As String
Döndürülenler
içinde DataSetdepolanan verilerin XML gösterimi için XML Şeması olan dize.
- Öznitelikler
Örnekler
Aşağıdaki örnek bir DataSet ve DataTableoluşturur ve ardından şemayı XML biçiminde görüntüler.
private static void DemonstrateGetXml()
{
// Create a DataSet with one table containing
// two columns and 10 rows.
DataSet dataSet = new DataSet("dataSet");
DataTable table = dataSet.Tables.Add("Items");
table.Columns.Add("id", typeof(int));
table.Columns.Add("Item", typeof(string));
// Add ten rows.
DataRow row;
for(int i = 0; i <10;i++)
{
row = table.NewRow();
row["id"]= i;
row["Item"]= "Item" + i;
table.Rows.Add(row);
}
// Display the DataSet contents as XML.
Console.WriteLine( dataSet.GetXml() );
}
Private Shared Sub DemonstrateGetXml()
' Create a DataSet with one table
' containing two columns and 10 rows.
Dim dataSet As New DataSet("dataSet")
Dim table As DataTable = dataSet.Tables.Add("Items")
table.Columns.Add("id", Type.GetType("System.Int32"))
table.Columns.Add("Item", Type.GetType("System.String"))
' Add ten rows.
Dim row As DataRow
Dim i As Integer
For i = 0 To 9
row = table.NewRow()
row("id") = i
row("Item")= "Item" & i
table.Rows.Add(row)
Next
' Display the DataSet contents as XML.
Console.WriteLine( dataSet.GetXml() )
End Sub
Açıklamalar
Bu yöntemi çağırmak, yalnızca birincil şemanın yazılıyor olması dışında çağrısıyla WriteXmlSchemaaynıdır.
GetXmlSchema XML'yi dize olarak döndürür ve bu nedenle dosyaya XML yazmaktan WriteXmlSchema daha fazla ek yük gerektirir.
Şema çıkarımı kullanarak derleyip DataSet XML veya Web hizmetlerini kullanarak seri hale getirdiğinizde sütun sıralama değişebilir.