不好意思,就是
我弄了个很简单的exe,就是用dbgrid1显示adoquery1的查询。
将file1.dbf放在和exe的同一个文件夹下,将文件夹放到我机子上的任何目录下都可以运行,在我机子上运行没问题,放到其它机子运行exe就提示:
Microsoft Jet 数据库引擎找不到对象XXXX.dbf,请确定对象是否存在,并正确写出它的名称和路径。(所有机子都安装了foxpro的,但只有我的装delphi)。
procedure TForm1.Button1Click(Sender: TObject);
var
strsql:string;
ApplicationPath:string;
begin
ApplicationPath := extractFilePath(Application.ExeName);
strsql:='select * from file1 ' ;
with ADOQuery1 do
begin
close;
Sql.Clear ;
Sql.Add(strsql);
connectionstring:= 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+ applicationpath +';Extended Properties=dBase 5.0;Persist Security Info=False';
open;
end;
end;
可否解析一下为什么吗??谢谢谢谢