Advertisement
Guest User

Untitled

a guest
Aug 2nd, 2015
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. private CoffeeShopDBEntities cse = new CoffeeShopDBEntities();
  2.  
  3. private void AddProductsToTabbedPanel()
  4. {
  5.  
  6. // using (CoffeeShopDBEntities context = new CoffeeShopDBEntities())
  7. //--found this on msdn..got rid of old but end up w/2 new errors see below
  8. {
  9. //the foreach code below goes here
  10. }
  11.  
  12.  
  13. foreach(TabPage tp in tabControl1.TabPages)
  14. {
  15.  
  16. ObjectQuery<tblProduct> filteredProduct = new ObjectQuery<tblProduct>
  17. ("SELECT VALUE P FROM tblProducts AS P", cse);
  18.  
  19. //when 'context' used 1)possible mistaken empty statment
  20. //2)the name 'context' doesnt exist in the current context
  21.  
  22. //when 'cse'used :
  23. //Error 1 The best overloaded method match for 'System.Data.Objects.ObjectQuery<P.tblProduct>.ObjectQuery(string, System.Data.Objects.ObjectContext)' has some invalid arguments
  24. //Error 2 Argument 2: cannot convert from 'P.CoffeeShopDBEntities' to 'System.Data.Objects.ObjectContext'
  25.  
  26. foreach (tblProduct tprod in filteredProduct)
  27. {
  28. Button b = new Button();
  29. b.Text = tprod.Description;
  30. tp.Controls.Add(b);
  31. }
  32. }
  33. }
  34.  
  35. List<tblProduct> filteredProducts = cse.tblProducts.ToList();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement