Cannot implicitly convert type 'System.Linq.IQueryable<int>' to 'int?'

Posted by Aneef on Stack Overflow See other posts from Stack Overflow or by Aneef
Published on 2010-04-04T17:26:51Z Indexed on 2010/04/04 17:33 UTC
Read the original article Hit count: 1268

Filed under:
|
|

Hi this is my code

var cityList = from country in doc.Element("result").Element("cities").Descendants("city")
                         select new
                         {
                             Name = country.Element("name").Value,
                             Code = country.Element("code").Value,
                             CountryCode = int.Parse(country.Element("countrycode").Value)
                         };


        foreach(var citee in cityList)
        {
        City city = new City();

        city.CountryID = from cnt in db.Countries where cnt.DOTWInternalID == citee.CountryCode select cnt.ID;
        }

Im getting an error on the second query as the title of this post, i tried converting to int, to nullable int nothing worked? help me guys

Thanks,

© Stack Overflow or respective owner

Related posts about LINQ

Related posts about iqueryable