I have two almost same databases (both are *.mdb), but one of them has few new tables. Now I can only detect tables, that should be imported, using code below:
public static List<string> GetDBTables(string path)
{
List<string> allTables = new List<string>();
String connect = ("Provider=Microsoft.JET.OLEDB.4.0;data source="
+ path + ";Persist Security Info=False;");
OleDbConnection con = new OleDbConnection(connect);
con.Open();
DataTable tables = con.GetOleDbSchemaTable(OleDbSchemaGuid.Tables,
new object[] { null, null, null, "TABLE" });
int counter = 1;
foreach (DataRow row in tables.Rows)
{
allTables.Add(row[2].ToString());
counter++;
}
con.Close();
return allTables;
}
var withNewTables = GetDBTables(".\\one.mdb");
var withoutNewTables = GetDBTables(".\\another.mdb");
var NotFoundTables = withNewTables.Except(withoutNewTables).ToList();
How can I import these tables in the old database using C #?