[RESOLVED] Updating Access Database
Hi,
I am binding the Datagrid by
Code:
DataGrid1.DataSource = ds
now when i make any changes in the Datagrid how do i make the changes refect in the database..i..e how do i update the database
I know that I can update the database with a single record by this
Code:
ds.Tables("Books").Rows(1).Item("Author") = txt1.Text
da.Update(ds, "books")
This is done only if i know that the record in row 1 and Column Authors has to be changed..
where da is the data adapter and ds is the dataset
Please advice...
Re: Updating Access Database
You're trying to complicate things.
1. Get your data:2. Bind your data:
vb Code:
DataGrid1.DataMember = "books"
DataGrid1.DataSource = ds
3. The user makes as many changes as they like. They may add, edit or delete as many rows as they want.
4. Save the changes:That's it. When the user edits the data in the grid those changes are automatically propagated to the bound DataTable. That's exactly what data-binding is for. Once all the changes are complete you save the whole lot with one call to Update.
Re: Updating Access Database
Oh....Thank You very much....
:)
This works wonders..DataGrid1.DataMember = "books"
I didn't knew about this binding using .Datamember...
Thanks a Lot...:wave: