Update the data in the DataGridView and save changes in the database



Update the data in the DataGridView and save changes in the database

After editing the data in the cells, if you would like to update the changes permanently in the database, use the following code:
C#
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            DataTable dt = ds.Tables["Orders"];
           this.dgv.BindingContext[dt].EndCurrentEdit();
            this.da.Update(dt);
        }

No comments:

Post a Comment