Copy Command

Why won't the Update Command work here?
DS1 has 3 rows and DS2 is empty. Both have the same schema with
col1 being the primary key. I want to copy DS1 to DS2 and save the
changes back to the original database but Update doesn't do that here.

Dim connection1 As New OleDbConnection
connection1.ConnectionString = conString
Dim myAdapter1 As OleDbDataAdapter = New OleDbDataAdapter(FillStr, connection1)
Dim DS1 As DataSet = New DataSet
myAdapter1.Fill(DS1)
Me.DataGridView1.DataSource = DS1.Tables(0)

Dim connection2 As New OleDbConnection
connection2.ConnectionString = conString2
Dim myAdapter2 As OleDbDataAdapter = New OleDbDataAdapter(FillStr2, connection2)
Dim builder As OleDbCommandBuilder = New OleDbCommandBuilder(myAdapter2)
builder.ConflictOption = ConflictOption.OverwriteChanges
Dim DS2 As DataSet = New DataSet
myAdapter2.Fill(DS2)
Me.DataGridView2.DataSource = DS2.Tables(0)

'Grid1 now shows 3 rows of data and Grid2 shows an empty table
'Both DataSets have the same schema with Col1 being the primary key

DS2.AcceptChanges()
DS2 = DS1.Copy
myAdapter2.Update(DS2)
'Grid2 now matches Grid1 but the Update command does not force the
'changes back to the database. Why not?
[1501 byte] By [mccreatl] at [2007-11-19 17:20:19]
# 1 Re: Copy Command
If you call the AcceptChanges() method in a DataSet, rows are not marked any more as "changed", so the DataAdapter won't update any rows against your data source.
iloire at 2007-11-10 3:30:34 >