Hello,
I'm using the following code to load data on a gridView and bind them to a bindNavigator.
da = new SqlDataAdapter("SELECT * FROM Users", connectionstring);
ds = new DataSet();
da.Fill(ds);
bs = new BindingSource();
bs.DataSource = ds.Tables[0].DefaultView;
userBindNav.BindingSource = bs;
userGridView.DataSource = bs;
How can I save changes to database after editing data (insert, update, delete)?
Thank you in advance.
How to save changes of a dataGridView
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Dipankar BiswasRank #992 · 2K reputationPosted May 12, 2015, 10:24 PM EDT
check this link..http://www.codeproject.com/Questions/482144/C-plushowplustoplussavepluschangesplusinplusdata
http://stackoverflow.com/questions/17807373/why-it-doesnt-save-changes-into-datatable-from-datagridview
Nanhe SiddiqueRank #1,103 · 1.7K reputationPosted May 12, 2015, 10:32 PM EDT
da.Update(ds.Tables(0))
it may help you
DealyRank #9,518 · 205 reputationPosted May 13, 2015, 3:53 AM EDT
This is what I've tried but I'm getting the following message "Update requires a valid UpdateCommand when passed datarow collection with modified rows."
private void saveToolStripButton_Click(object sender, EventArgs e)
{
try
{
da.Update(ds.Tables[0]);
}
catch (Exception ex){MessageBox.Show(ex.Message);}
}
Any suggestions?