S
shirong
Unregistered / Unconfirmed
GUEST, unregistred user!
ado使用jet无法读取有密码的mdb文件?
请看一下代码
procedure TForm1.spbopenClick(Sender: TObject);
var
myaccess:string;
const
mystr1='Provider=%s;Data Provider=%s;Data Source=%s';
myprovider='msdatashape.1';
mydataprovider='Microsoft.Jet.OLEDB.4.0';
begin
if opdgfile.Execute then
begin
edfilename.Text:=opdgfile.FileName;
edpswd.Text:=GetAccessPassword(opdgfile.FileName);//此为读取mdb文件密码
myaccess:=opdgfile.FileName;
adoconnection1.connected:=false;
adoconnection1.ConnectionString:=format(mystr1,[myprovider,mydataprovider,myaccess]);
adoconnection1.Connected:=true;
adoconnection1.GetTableNames(lbtable.items);
end;
end;
此代码在读取无密码的mdb文件时一切正常,但是在读有密码的mdb文件时死活不读,报告说”无法启动
应用程序,工作组信息文件丢失,或是已被其他用户打开”,退出ide环境也不行,在连接串中添加pwd=
uid=passwd=均无效。
甚至我直接编辑adoconnection1.ConnectionString(选Jet.OLEDB.4.0)只要测试连接就会出现这种情况,
但是选provider for odbc driver可以顺利通过,但这样要写dsn文件,我不想这样,求求哪位高人告知我
错在哪里?
我用的是win2000专业版,delphi5,access97
shirong21cn@163.com
请看一下代码
procedure TForm1.spbopenClick(Sender: TObject);
var
myaccess:string;
const
mystr1='Provider=%s;Data Provider=%s;Data Source=%s';
myprovider='msdatashape.1';
mydataprovider='Microsoft.Jet.OLEDB.4.0';
begin
if opdgfile.Execute then
begin
edfilename.Text:=opdgfile.FileName;
edpswd.Text:=GetAccessPassword(opdgfile.FileName);//此为读取mdb文件密码
myaccess:=opdgfile.FileName;
adoconnection1.connected:=false;
adoconnection1.ConnectionString:=format(mystr1,[myprovider,mydataprovider,myaccess]);
adoconnection1.Connected:=true;
adoconnection1.GetTableNames(lbtable.items);
end;
end;
此代码在读取无密码的mdb文件时一切正常,但是在读有密码的mdb文件时死活不读,报告说”无法启动
应用程序,工作组信息文件丢失,或是已被其他用户打开”,退出ide环境也不行,在连接串中添加pwd=
uid=passwd=均无效。
甚至我直接编辑adoconnection1.ConnectionString(选Jet.OLEDB.4.0)只要测试连接就会出现这种情况,
但是选provider for odbc driver可以顺利通过,但这样要写dsn文件,我不想这样,求求哪位高人告知我
错在哪里?
我用的是win2000专业版,delphi5,access97
shirong21cn@163.com