string test = "/";
var results = from table1 in data2.AsEnumerable()
join table2 in data1.AsEnumerable()
on ((string)(table1["ANo"]) + test + (string)table1["MNo"]) equals (string)table2["File_Code"]
where (float)table1["c1"] != 0
&& (string)table1["Case_Status"] == "Open"
select new
{
ACode = (int)table1["ACode"],
ANo = (int)table1["ANo"],
c1 = (int)table1["c1"]
};
Getting a error:
Specified Cast is invalid on ((string)(table1["ANo"]) + test + (string)table1["MNo"]) equals (string)table2["File_Code"].
So in my linq I am trying to match ANo/MNo in one database to File_Code in another where ANo & MNo are different columns in the first database, any ideas?
data1anddata2? That's probably going to be quite important to answer the question :) Note that you have to use.ToString()instead of(string)if the data isn't actually a string, but rather a number for example.(string)does a cast, if possible, while.ToString()does a conversion, two very different things.