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?
Asked
Active
Viewed 723 times
0
-
1Pardon 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 Answers
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
-
What unit should I include into the uses section for the createOLEObject function? – The Bitman Jan 27 '17 at 15:44
-
1
-
Whatever tutorial you were already reading should already be covering these things, including how to acquire the DLL you need, right? – Jerry Dodge Jan 27 '17 at 15:47
-
Thx for your ansver Kobik. It created the mdb file despite the adox component wasn't in the type library list (msadox*.dll not found by default) – The Bitman Jan 27 '17 at 16:13
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
-
-
1You 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
-
-
1And? 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