예제 #1
0
        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);
            }
        }
예제 #2
0
 private void Form1_Load(object sender, EventArgs e)
 {
     db = new DbEntity2Entities();
     artigosBindingSource.DataSource = db.Artigos.ToList();
 }