时间:2021-07-01 10:21:17 帮助过:55人阅读
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)
孤狼