matsnake86 matsnake86 - 17 days ago 4
C# Question

Merging tables from different access DB

I am trying to merge data from a table access db to another identical table into another access db.

I'm working with table adapters and controls which are bound to a binding source.

I can successfully import the data I want into a temporary data table and merge it with the data table bound to the control (a devexpress grid view).

The grid updates properly, but I am not able to actually save changes made to the dataset.
What am I missing?

Tried this code:

this.myDs.myDT.Merge(importedDT); //works fine the grid actually updates
this.mybindingsource.endedit();
this.mytableadapter.adapter.update(this.myDs.myDT); //no update at all on db

Answer

Have you considered a query?

 INSERT INTO aTable 
 SELECT * FROM [;DATABASE=Z:\Path\aDB.accdb].bTable

This will insert data from a second database into the database table in the connection that you run against.