EmersonH.Com

Transforming Knowledge into Power

  • Increase font size
  • Default font size
  • Decrease font size
Home VB.Net 2008 Data Load xml document to DataSet

Load xml document to DataSet

E-mail Print

Shared Sub Main()
Dim DSStudentClasses As New DataSet()
Dim tmpNode As XmlNode
' Load the schema into the DataSet
DSStudentClasses.ReadXmlSchema("StudentClasses.xsd")
' Load the DataSet into the data document
Dim XDocStudents As New XmlDataDocument(DSStudentClasses)
' Load the data into the data document
XDocStudents.Load("Students.xml")
Console.WriteLine("Students in DataSet:")
Dim Row As DataRow
For Each Row In DSStudentClasses.Tables("Student").Rows
Console.WriteLine("{0}:{1}", Row("Name"), Row("GPA"))
tmpNode = XDocStudents.GetElementFromRow(Row)
Console.WriteLine( _
" Locker Combination (from XML, not DataSet): {0}", _
tmpNode.SelectSingleNode("LockerCombination").InnerText)
Dim Subject As DataRow
For Each Subject In Row.GetChildRows("StudentClasses")
Console.WriteLine(" {0}", Subject("Title"))
Next
Next
End Sub

Last Updated on Monday, 21 December 2009 17:39