Answer the question
In order to leave comments, you need to log in
Linq.Dynamic and DataTable?
Has anyone worked with the LINQ dynamic library?
How, having 2 DataTables, to make an INNER JOIN ?
I'm trying to do it this way:
C# Select code
var res2 = newDT.AsEnumerable().AsQueryable().Join(oldDT.AsEnumerable(), "new (@0 as T1)",
"new (@0 as T2)",
"new (T2 as Alias)", new object[] { "t2" } );
but an error occurs:
Additional information: Unknown identifier 'T2'
Answer the question
In order to leave comments, you need to log in
Try using SQL like syntax. Perhaps it will become clearer that how JOIN is
var temp = from t in A
join b in B on t.Site = b.Site AND t.C = b.C
where condition
select what you need
At the request formation stage, you do not have the T2 object. There is a difference between Enumerable and Queryable. The Enumerable type - LINQ will execute as a pipeline, executing each extension in a chain. And Queryable will take all the chains at once and will try to form one SQL query. Therefore, your conversion .AsEnumerable().AsQueryable() is not entirely clear to me because I understand that DT initially returns a Queryable.
Basically, do this "new (@0 as T2)" somewhere before your join.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question