function compactdb(access_url,access_backup_url,bkdbname,is97) dim fso set fso=createobject(scripting.filesystemobject) if fso.fileexists(access_url) then dim je set je=createobject(jro.jetengine) if is97=true then je.compactdatabase provi
function compactdb(access_url,access_backup_url,bkdbname,is97)
dim fso
set fso=createobject(scripting.filesystemobject)
if fso.fileexists(access_url) then
dim je
set je=createobject(jro.jetengine)
if is97=true then
je.compactdatabase provider=microsoft.jet.oledb.4.0;data source=&access_url,provider=microsoft.jet.oledb.4.0;data source=&access_backup_url&temp.mdb;jet oledb:engine type=4
else
je.compactdatabase provider=microsoft.jet.oledb.4.0;data source=&access_url,provider=microsoft.jet.oledb.4.0;data source=&access_backup_url&temp.mdb
end if
fso.copyfile access_backup_url&temp.mdb,access_url
fso.copyfile access_backup_url&temp.mdb,access_backup_url&bkdbname&.asa
fso.deletefile(access_backup_url&temp.mdb)
set fso=nothing
set je=nothing
compactdb=你的数据库,已经被压缩并备份!
else
compactdb=你输入的数据库路径或名称未找到,请重试!
end if
end function
dim access_url,access_backup_url,bkdbname
access_url=e:\scjd\admin\scjd_data\%50%69%7a%69%67%65.mdb '数据库的物理路径
access_backup_url=e:\scjd\admin\scjd_backup\ '数据库备份的物理路径
bkdbname=%50%69%7a%69%67%65 '数据库备份的文件名
response.write compactdb(access_url,access_backup_url,bkdbname,false)
孤狼
