adox

How to use ADOX to connect to existing Access database

眉间皱痕 提交于 2020-01-15 03:42:12
问题 From a quick google i found out how to use ADOX to create a new database and add some tabels and rows to it. Here is an example: using ADOX; ... ADOX.Catalog cat = new ADOX.Catalog(); cat.Create("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=mydb.accdb;"); Table mainTable = new Table(); mainTable.Name = "Test Table"; mainTable.Columns.Append("Column_1"); cat.Tables.Append(mainTable); This creates a new database and works with that newly created database but If I had an existing database, how

how to add foreign key to access table using adox

社会主义新天地 提交于 2019-12-25 06:34:55
问题 I am trying to creat a database with two tables. i want to add in a foreign key in one of them. but the following code is not working, i debug it and i found that the only problem is in adding the foreign key. private static bool creatDatabase() { bool result = false; Catalog cat = new Catalog(); Table tableCustomer = new Table(); Table tableAddresses = new Table(); //Create the table Customer and it's fields. tableCustomer.Name = "Customer"; tableCustomer.Columns.Append("Customer_ID", ADOX

How can I use ADOX components in Delphi XE4?

*爱你&永不变心* 提交于 2019-12-12 02:31:46
问题 I read in a tutorial written to Delphi 6 : to install ADOX components, select from the main menu Project\Add type Library menu item. But in Delphi XE4 there is not such a menu item. How could I install/use ADOX components in Delphi XE4 to create an empty mdb database programatically? Or is there any other way to create it without ADOX? 回答1: You could use late binding without importing the type library e.g.: uses ComObj; procedure CreateNewMDB(const FileName: WideString); var AdoX: OleVariant;

How can I access a view command through T-SQL?

余生颓废 提交于 2019-12-11 05:59:43
问题 I'd like to be able to retrieve programmatically the command strings that generate the views on our SQL Server. I though the ADOX collection, used together with an ADODB connection, will allow us to access this through the catalog/view/command property. Unfortunately, the 'views' collection is not available when connecting from an MS-Access client to a SQL Server through an ADO connection, which is our case (see Cannot Use ADOX Views Collection with SQL Server). I hope I could now find a T

ADO.NET way for creating a linked table

旧城冷巷雨未停 提交于 2019-12-09 00:57:13
问题 I'm writing an application that uses ADO.NET OLEDB provider. Database is Access. Most of DB interaction is through DDL/DML SQL queries. I now need to create linked tables and there doesn't seem to be a way of doing that with ADO.NET alone. Neither in a simple DDL query, nor with trying to manipulate Access system tables directly. I'm trying to avoid using ADOX, with the extra reference/dependency in my application. Anyone knows a way around this? Much appreciated. Here's how I currently