I’m trying to get this LINQ to SQL to work. The problem is parsedSeasons is a string like “1,2,3” and h.season is an int column. How can I get this to work correctly?
var id = (from h in db.t_ref_harvest_type
where parsedSeasons.Contains(h.season)
select new { h.id });
You need to first split your comma delimited string like this:
Then use your LINQ query: