As usual, some background information first:
Database A (Access database) - contains a table in which there is information from two columns. Information from these two columns is necessary for the application, which will be used by people who cannot access database A.
Database B (Access database) - contains a table containing only two columns (mirrors for what we need from table A). Database B is available to all users of the application. One of the problems is that the column names do not match the names in the table from database A.
What I need to do is transfer the necessary data using a utility that will start automatically, say once a week (two databases do not have to be fully synchronized, they just close). The migration utility will be launched from a user account that has access to both databases (obviously).
Here's the approach I took (again, if there is a better way, please suggest away):
Take data from database A. These are only two columns from the required table.
Write the data to the [tablename] .txt file using the DataReader object and the WriterStream object. I did this, so I can use the schema.ini file and force the data columns to have the same name as database B.
Create a DataSet containing a DataTable that reflects a table from database B.
.txt DataTable Microsoft.Jet.OLEDB.4.0 , hdr = yes fmt = delimited ( , schema.ini .txt). DataAdapter DataTable.
DataSet, DataTable, B.
B, , , A. DataAdapter DataTable ( 5, ).
DataTable, A ( .txt, ).
B .
, DataAdapter, B. , DataSet-From-Database-B.Merge(Dataset-From-TxtFile [tableName]) HasChanges. , DataSet-From-Database-B.Update .
, DataSet-From-TxtFile B , ? ?
, B B, ( DataSet row.SetAdded, , HasChanges), , .
# 2.0 Framework ( , DataTables TableAdapters DataSets DataAdapters, , ).