我用的连接语句Const
connstr='Provider=Microsoft.Jet.OLEDB.4.0;'+
'Data Source=%s;Persist Security Info=False;'+
'Jet OLEDB:Database Password=%s';procedure Tlogin.FormCreate(Sender: TObject);
var
dbfilename:string;
begin
dbfilename:=extractfilepath(application.ExeName)+'sfgl.mdb';
adoconnection1.ConnectionString:=format(connstr,[dbfilename,'']);
adoconnection1.open;
end;运行后,出现异常,提示信息如下:我怀疑是数据库名弄错了,程序把Project1.exesfgl.mdb当作数据库名了,我的数据库名是sfgl.mdb!
connstr='Provider=Microsoft.Jet.OLEDB.4.0;'+
'Data Source=%s;Persist Security Info=False;'+
'Jet OLEDB:Database Password=%s';procedure Tlogin.FormCreate(Sender: TObject);
var
dbfilename:string;
begin
dbfilename:=extractfilepath(application.ExeName)+'sfgl.mdb';
adoconnection1.ConnectionString:=format(connstr,[dbfilename,'']);
adoconnection1.open;
end;运行后,出现异常,提示信息如下:我怀疑是数据库名弄错了,程序把Project1.exesfgl.mdb当作数据库名了,我的数据库名是sfgl.mdb!
adoconnection1.ConnectionString:=format(connstr,[dbfilename,'']);
ConnectionString检查一下他里面有没有以前设定的信息
或者从新操作一次没碰到过这样的问题第一次呵呵慢慢来dbfilename:=extractfilepath(application.ExeName)+'sfgl.mdb';
没试一下他的返回结果看看