title: Object query in Entity Framework 6
body: <p>I'm getting an error with the <code>ObjectQuery</code> method, can someone help?</p>
  
  <pre><code>private void AddProductsToTabbedPanel()
          {
              foreach (TabPage tp in tabControl1.TabPages )
              {
                  ObjectQuery&lt;TblProduct&gt; filteredProduct = new ObjectQuery&lt;TblProduct&gt;("Select value p from TblProduct as P", csdbe);
  
                  foreach (TblProduct tpro in filteredProduct)
                  {
                      Button btn = new Button();
                      btn.Text = tpro.Description;
                      tp.Controls.Add(btn);
                  }
              }
          }
  </code></pre>
  
  <p>my logic here is that it adds button in control tab based on what is the content of TblProduct</p>
  
  <p>But I got an error:</p>
  
  <blockquote>
    <p>Argument 2: cannot convert from
    'Coffee_Shop.CoffeeShopDatabaseEntities' to
    'System.Data.Entity.Core.Objects.ObjectContext'</p>
    
    <p>The best overloaded method match for
    'System.Data.Entity.Core.Objects.ObjectQuery.ObjectQuery(string,
    System.Data.Entity.Core.Objects.ObjectContext)' has some invalid
    arguments</p>
  </blockquote>