C# creating a linked table in Access database

  • Thread starter Thread starter PremPR
  • Start date Start date
P

PremPR

Guest
Hi Team,

As we know that we can import data from HTML by linking the html file and it will be displayed in the list of table with a different type. Im trying hard to write a piece of code to achieve the same programmatically by opening a connection to access database and create a table of Linked HTML type. But, could not achieve the same.

Below is the sample code using ADODB and ADOX I have tried but seems some syntax error and throws "Could not find installable ISAM." when tables.Append line is executed.

CatalogClass cat = new CatalogClass();
string connectString = @"Provider=Microsoft.ACE.OLEDB.12.0;;Data Source="
+ "C:\\temp\\Data.mdb";
//+ "; Jet OLEDB:Engine Type=5";
Connection con = new Connection();
con.Open(connectString);
cat.ActiveConnection = con;
Table tblLink = new Table();
tblLink.Name = TableName;
tblLink.ParentCatalog = cat;

tblLink.Properties["Jet OLEDB:Remote Table Name"].Value = SourceTableName;
tblLink.Properties["Jet OLEDB:Link Provider String"].Value = @"C:\temp\D.html";
tblLink.Properties["Jet OLEDB:Create Link"].Value = true;

cat.Tables.Append(tblLink);

Could anyone please guide me what is wrong and how can I achieve this?

Regards,

Kumar

Continue reading...
 
Back
Top