Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

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

$
0
0
I've bound my combobox so that the value selected will appear on the datagridview. However, although the datagridview is editable, the changes made won't 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();
            }


Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>