Linq query Type Input error in Join call

I have looked at various stackoverflow answers, but I don't see a way to fix my linq connection.

2 tables

var query = from tips in TblTips where tips.Id == 30 join files in TblFiles on tips.Id equals files.Group select new { tips, files }; 

Error:

 Type inference failed in the call to Join 

Now tips.Id is int while files.Group is varchar

I tried to do. Value

 tips.id.Value --> the word Value not working (most recent linqpad) (int)files.Group --> it doesn't like that ... 
+6
source share
1 answer

The problem is that you cannot append the values โ€‹โ€‹of a table column of the wrong type!

 Convert.ToInt32(column) should work in linqpad and your c# application just fine. 

(I wrapped in parens and added ToList ())

This should work for you if the group is a string and id is int

 var query = (from tips in TblTips where tips.Id == 30 join files in TblFiles on tips.Id equals Convert.ToInt32(files.Group) select new { tips, files }).ToList(); 

UPDATE:

for OP, I agree with him that he should convert another value to a string

 var query = (from tips in TblTips where tips.Id == 30 join files in TblFiles on tips.Id.ToString() equals files.Group select new { tips, files }).ToList(); 
+6
source

All Articles