databasedelphiadox

How can I use ADOX components in Delphi XE4?


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?


Solution

  • 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.