I need to Compare Two dataTables.
dataTable A contains current set of Data on clients machine.
dataTable B contains future updates to dataTable A.
dataTable A structure
ID | firstname | lastName
1 | "test" | "last"
2 | "whatever" | "someone"
3 | "hi" | "hello
dataTable B Structure
ID | firstname | lastName
1 | "updated" | "yes"
2 ->deleted
3 | "hi" | hello" ->unchanged
4 | "new" |record " ->row added
When I go dataTableA.merge(datatableB)
I basically just get dataTableA with dataTableB added rows so for example
ID | firstname | lastName
1 | "test" | "last"
2 | "whatever" | "someone"
3 | "hi" | "hello
1 | "updated" | "yes"
3 | "hi" | hello" ->unchanged
4 | "new" |record " ->row added
It doesn't match on the IDs and get updated or deleted. I just want to compare two tables, update table A that should look exactly like table B. I'm not quite sure how to accomplish this properly.
Basically there is a SQL table in the clients machine that needs to get completed updated and sync exact to a datatable B that is being passed in. In theory i just want to take table B and basically update table A. So after I need to update the SQL table. I tried something like this.
Dim adapter = New SqlDataAdapter("select * from test_table2", connection)
Using (New SqlCommandBuilder(adapter))
adapter.Fill(dTable)
connection.Open()
adapter.Update(dTable)
End Using
Doesn't seem to work.