Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private CoffeeShopDBEntities cse = new CoffeeShopDBEntities();
- private void AddProductsToTabbedPanel()
- {
- // using (CoffeeShopDBEntities context = new CoffeeShopDBEntities())
- //--found this on msdn..got rid of old but end up w/2 new errors see below
- {
- //the foreach code below goes here
- }
- foreach(TabPage tp in tabControl1.TabPages)
- {
- ObjectQuery<tblProduct> filteredProduct = new ObjectQuery<tblProduct>
- ("SELECT VALUE P FROM tblProducts AS P", cse);
- //when 'context' used 1)possible mistaken empty statment
- //2)the name 'context' doesnt exist in the current context
- //when 'cse'used :
- //Error 1 The best overloaded method match for 'System.Data.Objects.ObjectQuery<P.tblProduct>.ObjectQuery(string, System.Data.Objects.ObjectContext)' has some invalid arguments
- //Error 2 Argument 2: cannot convert from 'P.CoffeeShopDBEntities' to 'System.Data.Objects.ObjectContext'
- foreach (tblProduct tprod in filteredProduct)
- {
- Button b = new Button();
- b.Text = tprod.Description;
- tp.Controls.Add(b);
- }
- }
- }
- List<tblProduct> filteredProducts = cse.tblProducts.ToList();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement