0

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?

The Bitman
  • 1,279
  • 1
  • 11
  • 25
  • 1
    Pardon my curiousity, but what are you wanting to do with ADOX that can't be done using Delphi's ADO components? – MartynA Jan 27 '17 at 15:04
  • [which at one point were moved to the `dbGo` component tab] . – Jerry Dodge Jan 27 '17 at 15:05
  • 1
    @MartynA, ADOX catalog for example. or creating an empty mdb file using it. – kobik Jan 27 '17 at 15:08
  • @MartynA I want to do what i have written. Creating an empty mdb file just programatically (without any ODBC wizard interaction). But as I wrote I interrested in any alternatve way as well if you explain it for me. – The Bitman Jan 27 '17 at 15:10
  • It appears everything ADOX does is something ADO can already do - it just makes it a little easier. – Jerry Dodge Jan 27 '17 at 15:11
  • @JerryDodge, Can you create an empty MDB database file with ADO? – kobik Jan 27 '17 at 15:50
  • @kobik I thought that's exactly what you're demonstrating in your answer? [Correction] Nope, I was mis-lead. – Jerry Dodge Jan 27 '17 at 16:01

2 Answers2

6

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.

kobik
  • 21,001
  • 4
  • 61
  • 121
1

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.

Jerry Dodge
  • 26,858
  • 31
  • 155
  • 327
  • Thx for the info. I tried it but the import dlg default list does not contain ADOX. Where can I download msadox.dll for Delphi XE4 from? – The Bitman Jan 27 '17 at 15:13
  • @TheBitman Well that's a whole different question. Refer back to the tutorial you were already reading. – Jerry Dodge Jan 27 '17 at 15:13
  • Or which version of msadox.dll needed for DXE4? – The Bitman Jan 27 '17 at 15:31
  • 1
    You may very well already have it. On Win 10, there are several copies in different places including c:\program files\common files\ado - there is an msadox28.tlb in that folder, too. – MartynA Jan 27 '17 at 15:34
  • And it's not necessarily a matter of getting the version needed for your Delphi version. But instead, the version which supports the capabilities you desire. Usually, that means the latest version you can find. – Jerry Dodge Jan 27 '17 at 15:39
  • @MartynA I have Win7 64 – The Bitman Jan 27 '17 at 15:48
  • 1
    And? I have Win7 64 in a VM and that has the same adox files in the same places. I have never wittingly installed them on any machine I use. If you haven't already, do a `dir msadox*.* /s > dump.txt & notepad dump.txt` from a c:\ prompt. – MartynA Jan 27 '17 at 15:56
  • @MartynA The dir command found it in : "c:\Program Files\Common Files\System\ado" folder. Thx for your ansvers/propounds. – The Bitman Jan 27 '17 at 16:22