Hi all,
I have a datatable MYTABLE_U2U so formed:
the elements number in second column can change.
So my goal is to select only adj elements when I specify Cell_id.
For i.e.:
In this case cc contains a1,a2,a3
Now...
if I decided to create a datatable so:
and then
cc_1 is a DataRowCollection but I cannot proceed to select elements of second column when Cell_Id="A"..
I tried several queries without success.
How can I convert datarowcollection into array of datarow?
thanks in advanced
Gio
I have a datatable MYTABLE_U2U so formed:
Code:
Cell_id adj
A a1
A a2
A a3
B b1
B b2
B b3
the elements number in second column can change.
So my goal is to select only adj elements when I specify Cell_id.
For i.e.:
vb.net Code:
Dim tabella = From alldata In MYTABLE_U2U.AsEnumerable Group By alldata!Cell_Id Into data = Group Select Cell_Id, p = data.CopyToDataTable.Rows Dim cc = ((From ele In tabella Where ele.Cell_Id ="A" Select dati = ele.p From ele1 In dati Select ele1.itemarray(0)).ToArray)
In this case cc contains a1,a2,a3
Now...
if I decided to create a datatable so:
vb.net Code:
Dim table As DataTable = New DataTable table.Columns.Add("Cell_Id") table.Columns.Add("adj", GetType(System.Data.DataRowCollection)) For Each ele In tabella table.Rows.Add(ele.Cell_Id, ele.p) Next
and then
vb.net Code:
Dim cc_1 = ((From ele In table.Rows Where ele.ItemArray(0) = "A" Select data = ele.itemarray(1)
cc_1 is a DataRowCollection but I cannot proceed to select elements of second column when Cell_Id="A"..
I tried several queries without success.
How can I convert datarowcollection into array of datarow?
thanks in advanced
Gio