Save data to database from DatagridView

MartinaL

Active member
Joined
Jun 13, 2006
Messages
30
Programming Experience
1-3
I have a datagrid view that is bound to a stored procdure.

I have a save button at the bottom, when it is clicked I want it to save selected columns to a database table.

I have added the query to the table adapter for the table I want to save to which updates the entry in the table, but How do i get the values out of the DatagridView for those that have been edited and save them to the table?

The stored procdure that populates the datagrid gets values from the table mentioned above and a few others.
 
I wasnt aware that DataGrids could be directly bound to stored procedures, but my oft quoted logic of datasets vs datareaders applies:

If you want to get info froma database, modify it and send it back, then you use a dataset


create a datatable whose table adapter select command reads from the stored procedure, but its update command targets a database table. read data from the database down into the datatable, put the table into the grid, edit it and send the table back
 
Back
Top