public Form2(Artigos obj) { InitializeComponent(); db = new DbEntity2Entities(); if (obj == null) { artigosBindingSource.DataSource = new Artigos(); db.Artigos.Add(artigosBindingSource.Current as Artigos); } else { artigosBindingSource.DataSource = obj; db.Artigos.Attach(artigosBindingSource.Current as Artigos); } }
private void Form1_Load(object sender, EventArgs e) { db = new DbEntity2Entities(); artigosBindingSource.DataSource = db.Artigos.ToList(); }