最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

深入淺析ASP在線壓縮access數(shù)據(jù)庫的方法

 更新時間:2020年09月14日 14:35:59   作者:青島星網(wǎng)  
這篇文章主要介紹了ASP在線壓縮access數(shù)據(jù)庫的方法,本文給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下

ASP在線壓縮ACCESS數(shù)據(jù)庫原理很簡單:利用JRO.JetEngine的壓縮功能建立一個新的數(shù)據(jù)庫文件,然后把原來的刪掉、替換!既然這樣,壓縮程序只需幾行就ok了!

把下面的代碼保存為**.asp,數(shù)據(jù)庫文件(db.md)放在相同目錄下,執(zhí)行asp搞定!

<%
oldDB = server.mappath("db.mdb") '更改數(shù)據(jù)庫地址
newDB = server.mappath("db_new.mdb") '生成臨時文件
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
Set Engine = Server.CreateObject("JRO.JetEngine")
prov = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
Engine.CompactDatabase prov & OldDB, prov & newDB
set Engine = nothing
FSO.DeleteFile oldDB '刪除臨時文件
FSO.MoveFile newDB, oldDB
set FSO = Nothing
response.write "OK"
%>

下面是一個ASP在線壓縮ACCESS數(shù)據(jù)庫的封裝函數(shù)

Function CompactDB(dbPath, boolIs97)
Dim fso, Engine, strDBPath
strDBPath = left(dbPath,instrrev(DBPath,"\"))
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(dbPath) Then
Set Engine = CreateObject("JRO.JetEngine")
On Error Resume Next
If boolIs97 = "True" Then
Engine.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dbpath, _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & "temp.mdb;" _
& "Jet OLEDB:Engine Type=" & JET_3X
Else
Engine.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dbpath, _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & "temp.mdb"
End If
 
If Err Then
response.write "<script LANGUAGE='javascript'>alert('無法識別數(shù)據(jù)庫類型.');history.go(-1);</script>"
response.end
end if
fso.CopyFile strDBPath & "temp.mdb",dbpath
fso.DeleteFile(strDBPath & "temp.mdb")
Set fso = nothing
Set Engine = nothing
CompactDB = "<script>alert('壓縮成功!');javascript:history.go(-1);</script>"
Else
CompactDB = "<script>alert('找不到數(shù)據(jù)庫!\n請檢查數(shù)據(jù)庫路徑是否輸入錯誤!');history.back();</script>"
End If
End Function 

總結

到此這篇關于ASP在線壓縮access數(shù)據(jù)庫的方法的文章就介紹到這了,更多相關ASP在線壓縮access數(shù)據(jù)庫內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!

相關文章

最新評論

招远市| 庄河市| 萍乡市| 丘北县| 石林| 贵溪市| 鄱阳县| 乐昌市| 海口市| 会宁县| 文水县| 娄烦县| 尼勒克县| 宁德市| 玉田县| 康马县| 浠水县| 茂名市| 芜湖县| 大港区| 宜州市| 湛江市| 平遥县| 东兴市| 华容县| 西青区| 沈丘县| 汉沽区| 汶上县| 西贡区| 定日县| 无锡市| 临桂县| 清徐县| 九江县| 泾阳县| 图们市| 兴业县| 陕西省| 滨州市| 呈贡县|