Hi,
I have created link tables between two access db using the adox like ...
ADODB.Connection cnDB1= new ADODB.Connection();
ADODB.Connection cnDB2= new ADODB.Connection();
ADOX.Catalog catDB1= new ADOX.Catalog();
ADOX.Catalog catDB2= new ADOX.Catalog();
ADOX.Table tblDB1;
string connStr = System.Configuration.ConfigurationSettings.AppSettings["strDBCon"].ToString();
cnDB1.Open(connStr,"","",-1);
catDB1.ActiveConnection = cnDB1;
string connStr1 = System.Configuration.ConfigurationSettings.AppSettings["strDBConApp"].ToString();
cnDB2.Open(connStr1,"","",-1);
catDB2.ActiveConnection = cnDB2;
foreach(ADOX.Table tblDB2 in catDB2.Tables ) // Loop through myDB2 catalog tables
{
if ( tblDB2.Type == "TABLE" ) // Link only user created tables not view and system table
{
tblDB1 = new ADOX.Table(); // Re-initialize object
tblDB1.Name = tblDB2.Name;
tblDB1.ParentCatalog = catDB1;
tblDB1.Properties["Jet OLEDB:Create Link"].Value = true;
tblDB1.Properties["Jet OLEDB:Link Datasource"].Value = "F:/db2.mdb";
tblDB1.Properties["Jet OLEDB:Remote Table Name"].Value = tblDB2.Name;
catDB1.Tables.Append(tblDB1); // Append tables to myDB1.mdb catalog
}
}
// Tidy up
cnDB1.Close(); cnDB1 = null;
cnDB2.Close(); cnDB2 = null;
tblDB1 = null; //tblDB2 = null;
catDB1 = null; catDB2 = null;
Now i have to remove the existing link... Any one please help me to solve this problem
Thanks,
SS
Answers
Know the answer? Post it. Somebody with the same question will find it here.