Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27251

VS 2010 convert EnumerableRowCollection to DataTable

$
0
0
Hi all,
I created my query:

vb.net Code:
  1. Dim query As EnumerableRowCollection = _
  2.             From miaTable In MYTABLE_Relation.Tables(0).AsEnumerable() _
  3.             Where miaTable!UtranCell_Id = label_master AndAlso lista.Contains(Microsoft.VisualBasic.Right(miaTable!target_cell, 2)) _
  4.             Select miaTable!UtranCell_Id, miaTable!target_cell, miaTable!selectionPriority
UtranCell_Id,target_cell,selectionPriority are string.
Now I want to convert this query in a DataTable. I used following code:
vb.net Code:
  1. Dim tabella_relation_intra As DataTable = New DataTable
  2. tabella_relation_intra = query.Cast(Of DataRow).CopyToDataTable

But I obtained error:
Impossible to execute cast of objects of type 'VB$AnonymousType_3`3[System.Object,System.Object,System.Object]' on type 'System.Data.DataRow'

So i cannot know how to proceed.
Any suggestion will be appreciated

thanks in advanced
Gio

Viewing all articles
Browse latest Browse all 27251

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>