0

i have two DataTables one with a hughe List of Results and one with a List of Companys from another DataBase.

Well i need to filter the Results on the Companys in the other DataTable.

Something like this:

DataTable Results

0 | FA1 | Resultx
1 | FA2 | Resulty
2 | FA3 | Resultz
3 | FA4 | ResultAA

DataTable Company

FA2
FA4

So i'm looking for a way to filter the first DataTable with the Results of the second DataTable.

Thanks Lim

Lim
  • 135
  • 1
  • 2
  • 8
  • You need two join to datatable see this post in StackOverflow [Create combined DataTable from two DataTables joined with LINQ. C#][1] [1]: http://stackoverflow.com/questions/2379747/create-combined-datatable-from-two-datatables-joined-with-linq-c-sharp – DeveloperX Nov 14 '11 at 07:47

1 Answers1

1

You could use Linq To Dataset. These are LINQ extension you can use against datatables.

This example shows you how do to a cross table query. It comes down to something like:

var query =
    from result in Results.AsEnumerable()
    join company in Companies.AsEnumerable()
    on result .Field<int>("....") equals
        company .Field<int>("....")
select new { .... }
Wouter de Kort
  • 39,090
  • 12
  • 84
  • 103