Updating database using dataadapter
For example, if you call Delete on a row on the Data Set, then when Update is called on the Data Adapter, the Delete Command of the Data Adapter will be called using the particular row in the Data Set.Note: Keep in mind that this Update is different than a SQL UPDATE statement.
After that I called the Data Adapter's Update method to save the changes to the database table.
It turns out that when you need the Insert Command from the My Sql Command Builder you have to specify the rowstate as added.
See also: MSDN //change this line Data Row da Row = data Recipe.
Note: The Tables member of Data Set represents all Data Table objects attached to a Data Set. Adding a Data Row to a Data Table In this example, I'll show you how to add edit, and remove, data from the Northwind database.
Listing 5-46 Creates a new Data Row, sets the data of Data Row members, and adds rows to the table using the Add method of Data Table. I'll display the result of the Customers table in a Data Grid after adding, updating, and deleting data from the table.The way the architecture works with the Data Adapter is that you can make any changes you want to the filled Data Set, and it won't affect the database until you call the Update method.