title: How to create a new DataTable from two DataTable using LINQ ASP.NET
body: <p>it's me again :D</p>
  
  <p>I am learning LINQ and there is something I want to do which I couldn't do. Please do Not suggest other solution which is not Linq. Thanks.</p>
  
  <pre><code>    Dim dtSong As DataTable = New DataTable("Songs")
      dtSong.Columns.Add("ID", GetType(Guid))
      dtSong.Columns.Add("Name", GetType(String))
      dtSong.Columns.Add("Type", GetType(String))
      dtSong.Columns.Add("AlbumID", GetType(Guid))
  
      Dim dtAlbum As DataTable = New DataTable("Album")
      dtAlbum.Columns.Add("ID", GetType(Guid))
      dtAlbum.Columns.Add("Name", GetType(String))
  
      Dim idsong, idalbum As Guid
      idalbum = Guid.NewGuid()
      dtAlbum.Rows.Add(idalbum, "Best of")
  
      idsong = Guid.NewGuid()
      dtSong.Rows.Add(idsong, "You are my sunshine", "Pop", idalbum)
      idsong = Guid.NewGuid()
      dtSong.Rows.Add(idsong, "twinkle twinkle", "Pop", idalbum)
      idsong = Guid.NewGuid()
      dtSong.Rows.Add(idsong, "you are my heart", "Rock", idalbum)        
  
  
      Dim query = From x In dtSong Join y In dtAlbum
                  On x.Field(Of Guid)("AlbumID") Equals
                  y.Field(Of Guid)("ID")
                  Where (x.Field(Of String)("Type") = "Pop")
                  Select New With
                       {
                          .Name = x.Field(Of String)("Name"),
                          .Type = x.Field(Of String)("Type"),
                          .Album = y.Field(Of String)("Name")
                      }
  
      Dim dtnew As DataTable = query.CopyToDataTable
  </code></pre>
  
  <p>I guess there is something wrong in my LINQ query. I am not allowed to use CopyToDataTable on this query. I can print out the result using a For Each loop though but I want to have a new DataTable. Thanks for the help. Sorry for poor english.</p>
  
  <p>L</p>