|
-
Apr 14th, 2007, 06:56 AM
#1
Thread Starter
Hyperactive Member
[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...
 If an answer to your question has been helpful, then please, Rate it! 
-
Apr 14th, 2007, 07:09 AM
#2
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.
-
Apr 14th, 2007, 07:34 AM
#3
Thread Starter
Hyperactive Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|