title: c# Build Error with LINQ syntax in Controller
body: <p>Hi folks I have the following error on line 11 in this controller code :</p>
  
  <pre><code>    public JsonResult GetChartData_IncidentsBySiteStatus(string SiteTypeId, string searchTextSite, string StartDate, string EndDate)
      {
          if (searchTextSite == null)
              searchTextSite = "";
  
          DateTime startDate = DateTime.Parse(StartDate);
          DateTime endDate = DateTime.Parse(EndDate);
  
          var sitesQry = _db.Sites;
          if (SiteTypeId != "-1")
              sitesQry = sitesQry.Where(a =&gt; a.SiteTypeId.ToString() == SiteTypeId);
  
          var qry = from i in _db.Incidents   
                    join s in _db.Sites on i.SiteId equals s.SiteId
                    where s.SiteDescription.Contains(searchTextSite)
                      &amp;&amp; (i.Entered &gt;= startDate &amp;&amp; i.Entered &lt;= endDate)
                    group s by s.SiteStatus.SiteStatusDescription + "[" + s.SiteTypeId.ToString() + "]"
                        into grp
                        select new
                        {
                            Site = grp.Key,
                            Count = grp.Count()
                        };
  
          return Json(qry.ToList()  , JsonRequestBehavior.AllowGet);
      }
  </code></pre>
  
  <p>...........the error is:</p>
  
  <blockquote>
    <p>Error 7   Cannot implicitly convert type
    'System.Linq.IQueryable' to
    'System.Data.Linq.Table'. An explicit conversion
    exists (are you missing a cast?)  C:\Documents and
    Settings\Administrator\Desktop\IRenewables_EMAS\IRenewables_EMAS\Controllers\IncidentController.cs    69  28  Emas.Web</p>
  </blockquote>
  
  <p>Can anyone suggest a workaround for this?</p>
  
  <p>thanks</p>