Y
yaya8163
Unregistered / Unconfirmed
GUEST, unregistred user!
我编写CGI,以下代码编译成功,但是执行出错,请各路高手指点
dbtemp.mdb数据库有生成
function CompactDatabase():boolean;
//压缩与修复数据库,覆盖源文件
const
SConnectionString = 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%s;'
+'Jet OLEDBatabase Password=%s;';
var
temp:string;
JE:OleVariant;
begin
temp:=LeftStr(WebDirectory,length(WebDirectory)-4)+'db/' ;
try
try
JE:=CreateOleObject('JRO.JetEngine');//建立OLE对象,函数结束OLE对象超过作用域自动释放
OleCheck(JE.CompactDatabase(format(SConnectionString,[temp+'db.mdb','']),
format(SConnectionString,[temp+'dbtemp.mdb',''])));//压缩数据库
DeleteFile(temp+'db.mdb');
RenameFile(temp+'dbtemp.mdb', temp+'db.mdb');
except
result:=false;//压缩失败
end;
finally
FreeAndNil(JE);
end;
dbtemp.mdb数据库有生成
function CompactDatabase():boolean;
//压缩与修复数据库,覆盖源文件
const
SConnectionString = 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=%s;'
+'Jet OLEDBatabase Password=%s;';
var
temp:string;
JE:OleVariant;
begin
temp:=LeftStr(WebDirectory,length(WebDirectory)-4)+'db/' ;
try
try
JE:=CreateOleObject('JRO.JetEngine');//建立OLE对象,函数结束OLE对象超过作用域自动释放
OleCheck(JE.CompactDatabase(format(SConnectionString,[temp+'db.mdb','']),
format(SConnectionString,[temp+'dbtemp.mdb',''])));//压缩数据库
DeleteFile(temp+'db.mdb');
RenameFile(temp+'dbtemp.mdb', temp+'db.mdb');
except
result:=false;//压缩失败
end;
finally
FreeAndNil(JE);
end;