怎样用代码实现对Access数据库的密码进行操作:设置、删除、修改密码
这个问题我在另外一个帖子发出有一个星期了,还没有得到解答,请各位高
手帮帮忙吧。附另一帖子的地址:
http://expert.csdn.net/Expert/topic/1505/1505594.xml?temp=3.152102E-02
这个问题我在另外一个帖子发出有一个星期了,还没有得到解答,请各位高
手帮帮忙吧。附另一帖子的地址:
http://expert.csdn.net/Expert/topic/1505/1505594.xml?temp=3.152102E-02
记得uses加上ComObj,ActiveXfunction CompactDatabase(AFileName,APassWord:string;ANewPassWord:string=''):boolean;
//压缩与修复数据库,覆盖源文件
var
STempFileName:string;
vJE:OleVariant;
begin
//if ANewPassWord='' then ANewPassWord:=APassWord;
STempFileName:=GetTempPathFileName;
try
vJE:=CreateOleObject('JRO.JetEngine');
vJE.CompactDatabase(format(SConnectionString,[AFileName,APassWord]),
format(SConnectionString,[STempFileName,ANewPassWord]));
result:=CopyFile(PChar(STempFileName),PChar(AFileName),false);
DeleteFile(STempFileName);
except
result:=false;
end;
end;function GetTempPathFileName():string;
var
SPath,SFile:array [0..254] of char;
begin
GetTempPath(254,SPath);
GetTempFileName(SPath,'~SM',0,SFile);
result:=SFile;
DeleteFile(result);
end;