问题描述
我读了一篇写给Delphi 6的教程:要安装ADOX组件,请从主菜单Project \ Add type Library菜单项中选择.但是在Delphi XE4中没有这样的菜单项.如何在Delphi XE4中安装/使用ADOX组件以编程方式创建一个空的mdb数据库?还是有没有其他方法可以在没有ADOX的情况下创建它?
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?
推荐答案
您可以使用后期绑定而无需导入类型库,例如:
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;
如果这是您所需要的,我认为导入ADOX类型库是不值得的.
If this is all you need, I think it's not worth the effort of importing the ADOX type library.
这篇关于如何在Delphi XE4中使用ADOX组件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!