views:

38

answers:

2

I am working with a DataGridView filled up from a view in my database.

Being a view (maybe I'm wrong) I can't use the TableAdapter.Update() method so I need to know the altered cells from the DataGridView so I can update the values in their respective tables programatically.

Can you help me?

+2  A: 

You are able to update Views http://msdn.microsoft.com/en-us/library/aa214068(v=SQL.80).aspx

You can also get the edited rows by called DataTable.GetChanges()

Barry
Unfortunately, I'm using a Strongly Typed Dataset bounded with the view, so I'll have to update it manually.
Juan Nunez
A: 

A DataGridView is only a transforming layer above the bounded DataTable. All changes applied to the view are directly materialized in the underlying DataTable. You can use the .DataSource property of your view to get a reference for this DataTable.

You have to create a DataAdapter with the appropriate SqlCommand objects for insert, update and delete.

After doing so you can use the DataAdapter.Update(DataTable table) method to apply all changes to the database.

d_schnell