title: "source is not IEnumerable<>" error when using SqlQuery(Type,string,object[]).AsQueryable()
body: <p>Here is the problem</p>
  
  <p>i am executing raw sql queries in controller as</p>
  
  <pre><code>var ctx=new DBModel();
  
  public ActionResult Grid(string tbname,string query,object args)
  {
     var obj = Activator.CreateInstance(Assembly.GetExecutingAssembly().GetType("Demo.Models." + tbname));
     dynamic queryresult;
     queryresult=ctx.Database.SqlQuery(obj.GetType(),query,args).AsQueryable();
  }
  </code></pre>
  
  <p>I am getting the result of query in queryresult when i am using</p>
  
  <pre><code>queryresult=ctx.Database.SqlQuery(obj.GetType(),query,args);
  </code></pre>
  
  <p>but when when i am applying AsQueryable to it for operations like Count i am getting the error as</p>
  
  <p>source is not IEnumerable&lt;></p>
  
  <p>Please Help to solve this</p>