Build up a DataSet : DataSet « Database ADO.net « VB.Net Tutorial






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








26.6.DataSet
26.6.1.Build up a DataSet