vb.net - Search DataTable with values from another table -
i'm trying search 1 datatable
values anotherdatatable
using linq, no progress far... how it?
in illustration below have table
, in search, , pltable
, has 1 column; , need retrieve every row table
, in name
field contains @ to the lowest degree 1 string of name
field in pltable
's rows.
dim epltable ienumerable(of datarow) = pltable.asenumerable() dim found = row in table.asenumerable row(0).contains(epltable) select row homecoming found.copytodatatable.rows
surely not work, .contains
wants string
argument
surely not work, .contains wants string argument
that's exatly problem, utilize typed field
extension method cast it's right type , enumerable.any
if @ to the lowest degree 1 string contained in name
:
dim strings = row in pltable select row.field(of string)(0) dim found = row in table.asenumerable strings.any(function(s) row.field(of string)("name").contains(s)) select row homecoming found.copytodatatable()
vb.net linq datatable linq-to-dataset
No comments:
Post a Comment