Click here to Skip to main content
15,888,984 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am connecting to a Microsoft Access database and using the OleDbDataAdapter to fill a DataTable with all the rows within the Access Table. I am binding this DataTable to a DataGridView control and allowing the user to update the values within this DataGridView control. When they hit save I want to update the Access Table so that it matches all the values within the DataTable. I can't quite figure out how to do this.

This probably isn't very difficult but I am having such a hard time!
Posted
Comments
ridoy 27-Oct-13 16:18pm    
have a look at it:http://stackoverflow.com/questions/7141725/help-with-updating-access-database-using-updatedatatable
MrGlass3 27-Oct-13 16:42pm    
I guess my problem is with the SQL query. I want to update the Access Table to have the exact data that is within the the DataTable. All the examples I see use "UPDATE [TableName] SET..." I don't know how to configure the SET since I want everything to update.
Richard.Berry100 27-Oct-13 18:04pm    
There is a DataAdapter.Update(DataTable) method. So you would need to supply an 'updated' Datatable as a argument - derived from your datagridview
MrGlass3 27-Oct-13 18:18pm    
To use that though I need to supply an UpdateCommand and I don't know what the CommandText should be. UPDATE [TableName] SET _______???
Richard.Berry100 28-Oct-13 0:50am    
From what I remember you supply a SELECT command.

see: http://stackoverflow.com/questions/8171647/c-sharp-using-dataadapter-to-update-sql-table-from-a-datatable-sql-table-no

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