Imports System.Xml
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim xmlDoc As New XmlDocument()
xmlDoc.Load("d:\product.xml")
Dim nodes As XmlNodeList = xmlDoc.DocumentElement.SelectNodes("/Table/Product")
Dim pID As String = "", pName As String = "", pPrice As String = ""
For Each node As XmlNode In nodes
pID = node.SelectSingleNode("Product_id").InnerText
pName = node.SelectSingleNode("Product_name").InnerText
pPrice = node.SelectSingleNode("Product_price").InnerText
MessageBox.Show(pID & " " & pName & " " & pPrice)
Next
End Sub
End Class
沒有留言:
張貼留言