stevennathaniel

LINQ : Menampilkan Hasil Query File XML

Oct 3rd, 2016
99
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Imports System.Linq
  2.  
  3. Imports System.Xml.Linq
  4.  
  5. Module Module2
  6.  
  7.     Dim pegawaiXML As XElement = XElement.Load("D:\StevenNathaniel\Proyek VB NET\LatihanXml6\LatihanXml6\LatihanXml6\bin\Debug\File2.xml")
  8.  
  9.  
  10.  
  11.  
  12.  
  13.     Sub Main()
  14.  
  15.         Dim pegawaiDoc = System.Xml.Linq.XDocument.Parse(pegawaiXML.ToString())
  16.  
  17.         Dim pegawaiA = From table In pegawaiDoc...<Table> Select table
  18.  
  19.         For Each table In pegawaiA
  20.  
  21.             Console.WriteLine("ID Pegawai {0}", table.<idpegawai>.Value)
  22.  
  23.             Console.WriteLine("Nama Pegawai {0}", table.<namapegawai>.Value)
  24.         Next
  25.  
  26.         Console.ReadLine()
  27.  
  28.  
  29.     End Sub
  30.  
  31. End Module
RAW Paste Data