private void dataGridView4_CellClick(object sender, DataGridViewCellEventArgs e) { int r = -1; try { ctx_pr = new bakeries_networkEntities(); r = Convert.ToInt32(dataGridView4.CurrentRow.Cells["CT_ID"].Value); categories ctg = (categories)dataGridView4.CurrentRow.DataBoundItem; var query = from p in ctx_pr.product where p.PR_CAT == ctg.CT_ID select p; query.Load(); productBindingSource1.DataSource = ctx_pr.product.Local.ToBindingList(); } catch (Exception) { } //MessageBox.Show("event " + r); //this.productTableAdapter.FillByProdCateg(myDataSet.product, r); }
public Form1() { InitializeComponent(); ctx = new BakeryDataEF.bakeries_networkEntities(); ctx.bakery.Load(); this.bakeryBindingSource.DataSource = ctx.bakery.Local.ToBindingList(); ctx.employee.Load(); this.employeeBindingSource.DataSource = ctx.employee.Local.ToBindingList(); ctx.product.Load(); this.productBindingSource.DataSource = ctx.product.Local.ToBindingList(); ctx.categories.Load(); this.categoriesBindingSource.DataSource = ctx.categories.Local.ToBindingList(); ctx.holders.Load(); this.holdersBindingSource.DataSource = ctx.holders.Local.ToBindingList(); ctx.positions.Load(); this.positionsBindingSource.DataSource = ctx.positions.Local.ToBindingList(); }