Dataadapter update not updating database

Rated 3.93/5 based on 803 customer reviews

Fill(ds Production,"Companies"); String str Development SQL = "SELECT * FROM [Global].[dbo].[Companies] WHERE Company ID ='" str SQLDest Database "'"; Sql Data Adapter da Development = new Sql Data Adapter(str Development SQL, cn Development SQL); Data Set ds Development = new Data Set(); da Development. If you call the Get Changes method on the second Data Set, I bet you'll find you get an empty Data Table in it.

When Update is called, the Data Adapter will attempt to execute each query (UPDATE, INSERT, DELETE) on every row of the Data Set that has been updated, inserted, and deleted.Thanks for any help you can offer, Ron "Peter Bromberg [C# MVP]" RSH, I haven't looked carefully at your code sample, but I'd be willing to bet that the reason you aren't getting any updates is because the Row States of the rows in the second Data Adapter's table don't reflect any changes.If you call the Get Changes method on the second Data Set, I bet you'll find you get an empty Data Table in it.As you can see from the code, I called the Find method to find the row and called the Delete method of the Data Row.After that I called the Data Adapter's Update method to save the changes to the database table.

Leave a Reply