我的ObjectQuery
方法有错误,有人可以帮忙吗?
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);
}
}
}
我的逻辑是它根据 TblProduct 的内容在控制选项卡中添加按钮
但我得到一个错误:
参数 2:无法从“Coffee_Shop.CoffeeShopDatabaseEntities”转换为“System.Data.Entity.Core.Objects.ObjectContext”
'System.Data.Entity.Core.Objects.ObjectQuery.ObjectQuery(string, System.Data.Entity.Core.Objects.ObjectContext)' 的最佳重载方法匹配有一些无效参数