Tag: adox

ADO.NET用于创建链接表的方式

我正在编写一个使用ADO.NET OLEDB提供程序的应用程序。 数据库是Access。 大多数DB交互都是通过DDL / DML SQL查询。 我现在需要创建链接表,似乎没有办法单独使用ADO.NET。 既不是简单的DDL查询,也不是尝试直接操作Access系统表。 我试图避免使用ADOX,在我的应用程序中使用额外的引用/依赖。 有人知道解决这个问题吗? 非常感激。 这是我目前如何使用ADOX创建链接表。 using ADOX; public static void CreateLinkedTable(string sourceDB, string sourceTable, string targetDB, string targetTable) { Catalog cat = new Catalog(); cat.let_ActiveConnection(“Provider=Microsoft.Jet.OLEDB.4.0;Data Source=” + targetDB); Table table = new Table(); table.Name = targetTable; table.let_ParentCatalog(cat); table.Properties[“Jet OLEDB:Create Link”].Value = true; table.Properties[“Jet OLEDB:Link Datasource”].Value = sourceDB; […]