public frmModificaStudent(Studenti obj)
 {
     InitializeComponent();
     db = new StudentEntities();
     studentiBindingSource.DataSource = obj;
     db.Studentis.Attach(studentiBindingSource.Current as Studenti);
 }
Exemple #2
0
 private void btnCauta_Click(object sender, EventArgs e)
 {
     using (CautareStudent frm = new CautareStudent())
     {
         if (frm.ShowDialog() == DialogResult.OK)
         {
             Studenti student = db.Studentis.FirstOrDefault(s => s.CNP == frm.sir);
             if (student != null)
             {
                 dataGridView.Update();
                 dataGridView.Refresh();
                 studentiBindingSource.DataSource = student;
             }
             else
             {
                 MessageBox.Show("Studentul NU este in baza de date.", "Mesaj");
             }
         }
     }
 }