?? compressdata.asp
字號:
<!--#include file="conn.asp"-->
<% if session("IsAdmin")<>true then
Response.Redirect "notlogin1.htm"
else
if session("loginpass")<>true then
Response.Redirect "notlogin.htm"
else
dim tmprs,rs
dim allarticle
dim Maxid
dim topic,username,dateandtime,body
call main()
set rs=nothing
conn.close
set conn=nothing
end if
sub main()
%><head>
<title>壓縮數據庫</title>
<link href="css.css" rel="stylesheet" type="text/css">
</head>
<BODY >
<table class=tableborder1 cellspacing=1 cellpadding=1 align=center>
<form action=CompressData.asp>
<tr>
<td class=tablebody1 height=25><b>壓縮數據庫--注意:</b><br>輸入數據庫所在相對路徑,并且輸入數據庫名稱(正在使用中數據庫不能壓縮,請選擇備份數據庫進行壓縮操作) <br>請先把原數據庫備份、改名為card.mdb然后再壓縮。壓縮完后把原數據庫改為其他名字,再把壓縮好的庫改名為<br>card.asp即可</td>
</tr>
<tr>
<td class=tablebody1>壓縮數據庫:<input type="text" name="dbpath" value=Data\card.mdb>
<input type="submit" value="開始壓縮"></td>
</tr>
<tr>
<td class=tablebody1><input type="checkbox" name="boolIs97" value="True">如果使用 Access 97 數據庫請選擇
(默認為 Access 2000 數據庫)<br><br></td>
</tr>
<form>
</table>
<%
Dim dbpath,boolIs97
dbpath = request("dbpath")
boolIs97 = request("boolIs97")
If dbpath <> "" Then
dbpath = server.mappath(dbpath)
response.write(CompactDB(dbpath,boolIs97))
End If
end sub
%>
<%
Const JET_3X = 4
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")
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
fso.CopyFile strDBPath & "temp.mdb",dbpath
fso.DeleteFile(strDBPath & "temp.mdb")
Set fso = nothing
Set Engine = nothing
CompactDB = "你的數據庫, " & dbpath & ", 已經壓縮成功!" & vbCrLf
Else
CompactDB = "數據庫名稱或路徑不正確. 請重試!" & vbCrLf
End If
End Function
end if
%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -