How do I save datagridview edits back into the database through entity framework?

  • Thread starter Thread starter Anon123456789qaz
  • Start date Start date
A

Anon123456789qaz

Guest
Ive bound my combobox so that the value selected will appear on the datagridview. However, although the datagridview is editable, the changes made wont save back to the database even is I use db.SaveChanges(). Is there another method?
private void cboeCID_SelectedIndexChanged_1(object sender, EventArgs e)
{
var CID = Convert.ToInt32(cboeCID.Text);

using (var db = new Entities2())
{

var course = from c in db.Student_Course
where c.CID == CID
select new Class1
{
SID = c.SID,
Mark = c.Mark

};

editDataGridView.DataSource = course.ToList();
}

Continue reading...
 
Back
Top