Click here to Skip to main content
15,890,947 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,
Can anyone tell me how to update the changes made to the datagridview back to database in C#.net windows apllication.
Any help is appreciated.
thanks,
Minakshi
Posted

1 solution

Have you bind the datagridview to database?

any way, i will explain here.
The BindingSource object keep our DataTable synchronized with the DataGridView. Set DataSource of the BindingSource to m_dataTable. After set the DataSource of the DataGridView to the BindingSource.

Now DataGridView shall be filled with the results of your SQL query fired.

At this point, any changes made in the DataGridView shall automatically be made to the DataTable, e.g. m_dataTable.

We can get the changes back into the database.

m_dataAdapter.Update(m_dataTable);

-- Regards,
Bhasker
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900