I want to variable take one of two queries but there are two different tables and I have error “Type of conditional expression cannot be determined because there is no implicit conversion between System.Linq.IQueryable<WGamesTicket> and System.Linq.IQueryable<AllGamesTicket>
var dsakj = (type == "mix") ?
(from el in objDC.WGamesTickets
where el.ticket.time == DTtemp
//&& el.typeOfGame == "mix"
select el)
:
(from el in objDC.AllGamesTickets
where el.ticket.time == DTtemp
//&& el.typeOfGame == "eng"
select el);
You’ll have to cast to a new custom class. For example, you’re pulling from two different tables, but maybe you want to collect the id and name from each. So change your code to: