简体   繁体   English

在MS Access中使用TADODataset组件时出错

[英]Error using TADODataset component with MS Access

I am attempting to replace a InterBase DB with a MS Access DB as a test, I am connect to the MS Access DB using the TADOConnection component successfully; 我正在尝试用MS Access DB替换InterBase DB作为测试,我已成功使用TADOConnection组件连接到MS Access DB。 however when I try to connect to a table using the TADODataset, I am able to set the Connection property to the TADOConnection component but when I want to set the CommandText property I receive the following error: 但是,当我尝试使用TADODataset连接到表时,我能够将Connection属性设置为TADOConnection组件,但是当我想设置CommandText属性时,会出现以下错误:

错误信息

The connectionstring is as follows: Provider=ADsDSOObject;User ID=admin;Encrypt Password=False;Data Source=C:\\StudyTime\\StudyTime.accdb;Mode=Read;Bind Flags=0;ADSI Flag=-2147483648; 连接Provider=ADsDSOObject;User ID=admin;Encrypt Password=False;Data Source=C:\\StudyTime\\StudyTime.accdb;Mode=Read;Bind Flags=0;ADSI Flag=-2147483648;如下所示: Provider=ADsDSOObject;User ID=admin;Encrypt Password=False;Data Source=C:\\StudyTime\\StudyTime.accdb;Mode=Read;Bind Flags=0;ADSI Flag=-2147483648;

Can someone please assist me? 有人可以帮我吗?

You are using a wrong provider: ADsDSOObject for ms-access. 您使用了错误的提供程序:用于ms-access的ADsDSOObject

Use Provider=Microsoft.Jet.OLEDB.4.0 or Provider=Microsoft.ACE.OLEDB.12.0; 使用Provider=Microsoft.Jet.OLEDB.4.0Provider=Microsoft.ACE.OLEDB.12.0; instead. 代替。

eg 例如

MdbFileName := 'C:\StudyTime\StudyTime.accdb';
ADOConnection1.ConnectionString := Format('Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%s;', [MdbFileName]);
ADOConnection1.Open;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM