Delphi:创建Access数据库(.mdb)而不使用Ms Access [英] Delphi: Creating Access DB (.mdb) without Ms Access

查看:613
本文介绍了Delphi:创建Access数据库(.mdb)而不使用Ms Access的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法创建Access数据库(.mdb)而不实际使用Ms Access?我想要我的应用程序创建它(当用户按下工具栏上的新建文档)时。

Is there a way to create Access databases (.mdb) without actually using Ms Access? I'd like my app to create it instead (when user presses "New Document" on the toolbar).

我正在使用Delphi 5 Ent。

I'm using Delphi 5 Ent.

提前感谢! : - )

Thanks in advance! :-)

推荐答案

如果您使用ADOX库,是否有一种方法。它是一个可以在Delphi中导入的ActiveX库。然后,您可以使用下面的代码创建一个新的数据库。请参阅此处

Yes there is a way if you use the ADOX library. It is an ActiveX library you can import in Delphi. Then you can create a new database with the code below. See here.

procedure TForm1.btnNewDatabaseClick(Sender: TObject);
var
 DataSource : string;
 dbName     : string;
begin
 dbName:='c:\aboutdelphi.mdb';

 DataSource :=
    'Provider=Microsoft.Jet.OLEDB.4.0' +
    ';Data Source=' + dbName +
    ';Jet OLEDB:Engine Type=4';

  ADOXCatalog1.Create1(DataSource);
end;

这篇关于Delphi:创建Access数据库(.mdb)而不使用Ms Access的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆