I'm getting an error with the ObjectQuery
method, can someone help?
private void AddProductsToTabbedPanel()
{
foreach (TabPage tp in tabControl1.TabPages )
{
ObjectQuery<TblProduct> filteredProduct = new ObjectQuery<TblProduct>("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);
}
}
}
my logic here is that it adds button in control tab based on what is the content of TblProduct
But I got an error:
Argument 2: cannot convert from 'Coffee_Shop.CoffeeShopDatabaseEntities' to 'System.Data.Entity.Core.Objects.ObjectContext'
The best overloaded method match for 'System.Data.Entity.Core.Objects.ObjectQuery.ObjectQuery(string, System.Data.Entity.Core.Objects.ObjectContext)' has some invalid arguments