Search This Blog

Saturday, April 24, 2010

Updating MS Access Linked Tables

Currently, I am trying to convert a VB6 application that uses a single MS Access database with links to 7 others  access databases using DAO linked tables to C# and ADO.NET.  For now, I am want to keep MS access for data storage.  One of the things I need is code to modify linked tables in MS Access database using C#.  Here is what I found so far:


from www.johnsoer.com -  Updating MS Access Links

    ADODB.Connection Con = new ADODB.Connection();
    ADOX.Catalog Cat = new ADOX.Catalog();
    
    Con.Open(connectionString, null, null, 0);
    Cat.ActiveConnection = Con;
    Cat.Tables[LinkedTableName].Properties["Jet OLEDB:Link Datasource"].Value = LinkedDatabaseLocation;
    Con.Close();
     

No comments: