0% found this document useful (0 votes)
21 views

Module Consume Hashtable

This code retrieves customer details from an XML file into a dataset, stores the dataset in a hashtable, retrieves it from the hashtable, and displays the values in the dataset on the console. It defines a function to load the dataset from an XML file into a hashtable, and the main subroutine gets the dataset from the hashtable, iterates through its rows and columns, and writes the values to the console.

Uploaded by

jotaalima
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

Module Consume Hashtable

This code retrieves customer details from an XML file into a dataset, stores the dataset in a hashtable, retrieves it from the hashtable, and displays the values in the dataset on the console. It defines a function to load the dataset from an XML file into a hashtable, and the main subroutine gets the dataset from the hashtable, iterates through its rows and columns, and writes the values to the console.

Uploaded by

jotaalima
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 1

Module Module1

Sub Main()

Dim htbl As System.Collections.Hashtable


htbl = GetHashTable()

Dim ds As DataSet = New DataSet()


ds = htbl("CustomerDetails")

' Display the dataset values on the console


Console.WriteLine(vbCrLf & "Customer Details" & vbCrLf)

Dim row As DataRow


For Each row In ds.Tables(0).Rows
Dim item As Object
For Each item In row.ItemArray
Console.WriteLine(item.ToString())
Next
Next

Console.ReadLine()

End Sub

Public Function GetHashTable() As System.Collections.Hashtable

Dim htbl As System.Collections.Hashtable


htbl = New System.Collections.Hashtable()

Dim ds As DataSet = New DataSet()


ds.ReadXml("SomeFile.xml")

htbl.Add("CustomerDetails", ds)

Return htbl
End Function
End Module

You might also like