ASP 온라인 압축 access 데이터 베 이 스 를 깊이 있 게 분석 하 는 방법

ASP 온라인 압축 ACCESS 데이터베이스 원 리 는 간단 합 니 다.JRO.JetEngine 의 압축 기능 을 이용 하여 새로운 데이터베이스 파일 을 만 든 다음 에 원래 의 것 을 삭제 하고 교체 합 니 다!기왕 이렇게 된 바 에 야 압축 프로그램 은 몇 줄 만 있 으 면 된다.
아래 코드 를**.asp 로 저장 하고 데이터베이스 파일(db.md)을 같은 디 렉 터 리 에 두 고 asp 를 실행 하 십시오!

<%
oldDB = server.mappath("db.mdb") '       
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 데이터베이스 의 패 키 징 함수 입 니 다.

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('         .');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('      !
!');history.back();</script>" End If End Function
총결산
여기에 ASP 온라인 압축 access 데이터베이스 방법 에 관 한 이 글 은 여기까지 소개 되 었 습 니 다.더 많은 관련 ASP 온라인 압축 access 데이터베이스 내용 은 우리 의 이전 글 을 검색 하거나 아래 의 관련 글 을 계속 조회 하 시기 바 랍 니 다.앞으로 많은 지원 바 랍 니 다!

좋은 웹페이지 즐겨찾기