How can I use ADOX components in Delphi XE4?

804 Views Asked by At

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?

2

There are 2 best solutions below

4
On BEST ANSWER

You could use late binding without importing the type library e.g.:

uses ComObj;

procedure CreateNewMDB(const FileName: WideString);
var
  AdoX: OleVariant;
begin
  AdoX := CreateOleObject('ADOX.Catalog');
  AdoX.Create('Provider=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type=5;Data Source=' + FileName);
end;

If this is all you need, I think it's not worth the effort of importing the ADOX type library.

8
On

Add type library was an option in older versions of Delphi. In more modern versions, go to Component > Import Component instead, where it has the option to Import a Type Library.