Dataadapter update not updating database

I wrote the code below, which doesn't error..it doesn't work..data is updated.

This is very odd because I can see that both of the datarows contain the correct value when I check in Debug mode, it just isn't updating the database.

Hi, I have a situation in where i have two instances of SQL server, the first is our Production Environment, the second is our Development environment.

Both servers contain the same databases but I need to write a utility that can transfer a row of data from the Production to the Development servers.

Peter -- Co-founder, developer portal: Blog: wrote: Hi, I have a situation in where i have two instances of SQL server, the first is our Production Environment, the second is our Development environment.

Open(); String str Production SQL = "SELECT * FROM [Global].[dbo].[Companies] WHERE Company ID ='" str SQLDest Database "'"; Sql Data Adapter da Production = new Sql Data Adapter(str Production SQL, cn Production SQL); Data Set ds Production = new Data Set(); da Production. Count Ron, Here's the "thing": When you bring data into a Data Table it doesn't matter if the data you brought in from a SQL Server table is "Changed" data.

To insert, update, and delete data using a Data Adapter, you create an Ole Db Command object with INSERT, UPDATE, and DELETE statements and set the Insert Command, Update Command, and Delete Command properties of the data adapter to Ole Db Command.

Open(); String str Production SQL = "SELECT * FROM [Global].[dbo].[Companies] WHERE Company ID ='" str SQLDest Database "'"; Sql Data Adapter da Production = new Sql Data Adapter(str Production SQL, cn Production SQL); Data Set ds Production = new Data Set(); da Production. There was definitely a change, I entered Null values in two of the fields in the database where the second server had values.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.Fill(ds Development,"Companies"); if (ds Production. Peter -- Co-founder, developer portal: Blog: wrote: Hi, I have a situation in where i have two instances of SQL server, the first is our Production Environment, the second is our Development environment.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.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.

Leave a Reply