本文整理匯總了VB.NET中System.Data.DataSet.GetXml方法的典型用法代碼示例。如果您正苦於以下問題:VB.NET DataSet.GetXml方法的具體用法?VB.NET DataSet.GetXml怎麽用?VB.NET DataSet.GetXml使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Data.DataSet
的用法示例。
在下文中一共展示了DataSet.GetXml方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: DemonstrateGetXml
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
示例2: DataSet.GetXml()
' 導入命名空間
Imports System.Data.SqlClient
Imports System.Data
Module Module1
Sub Main()
Try
Dim DS As New DataSet()
DS.ReadXml("Authors.XML")
Dim XMLContent As String = DS.GetXml()
Dim I As Integer
For I = 0 To DS.Tables(0).Rows.Count - 1
DS.Tables(0).Rows(I).Item("Author") = UCase(DS.Tables(0).Rows(I).Item("Author"))
Next
For I = 0 To DS.Tables(0).Rows.Count - 1
Console.WriteLine(DS.Tables(0).Rows(I).Item("Title"))
Console.WriteLine(DS.Tables(0).Rows(I).Item("Author"))
Console.WriteLine(DS.Tables(0).Rows(I).Item("Publisher"))
Console.WriteLine(DS.Tables(0).Rows(I).Item("Price"))
Next
DS.WriteXml("NewAuthors.xml")
Catch Ex As Exception
Console.WriteLine("Exception: " & Ex.Message)
Console.WriteLine(Ex.ToString)
Console.ReadLine()
End Try
End Sub
End Module