title: Error on Cout but i am not using Count in my LINQ exrpression,
body: <p>I am trying to return a set of data in JSON formate from a LINQ select ran against my EF Code First DB and am getting the error</p>
  
  <blockquote>
    <p>Count must be a DbConstantExpression or a DbParameterReferenceExpression. Parameter name: count </p>
  </blockquote>
  
  <p>but I am not sure why I am getting it as I am not using a <code>COUNT</code> parameter in my LINQ query so why am I getting this error?</p>
  
  <pre><code>    public ActionResult GetData(string sidx, string sord, int page, int rows)
      {
          try
          {
              //Get total rows
              int RowCount = db.Sections.Count();
  
              string OrderBy = (sidx + " " + sord);
  
              var SectionData = new
              {
                  total = (int)Math.Ceiling((float)RowCount / (float)rows),
                  page = page,
                  records = RowCount,
                  rows = (from s in db.Sections
                          select new
                          {
                              id = s.ID,
                              cell = new string[] {
                                  SqlFunctions.StringConvert((double)s.ID).Trim(),
                                  s.RouteName,
                                  s.Title
                              }
                              .OrderBy(x =&gt; sidx)
                              .Skip(page * rows)
                              .Take(rows)
                          }).ToArray()
              };
              return Json(SectionData, JsonRequestBehavior.AllowGet);
          }
          catch (Exception ex)
          {
              ErrorSignal.FromCurrentContext().Raise(ex);
              return Json(null, JsonRequestBehavior.AllowGet);
          }
  
      }
  </code></pre>