Office中国论坛/Access中国论坛
标题:
关闭时压缩数据库!的重大问题
[打印本页]
作者:
jingyingjingyin
时间:
2005-7-12 22:08
提示:
作者被禁止或删除 内容自动屏蔽
作者:
jingyingjingyin
时间:
2005-7-12 22:55
提示:
作者被禁止或删除 内容自动屏蔽
作者:
sweetduck
时间:
2005-7-15 01:29
以下是 DVBBS 7 后台用自定义函数压缩数据库代码,以供参考'====================压缩数据库 =========================
sub CompressData()If IsSqlDataBase = 1 Then
SQLUserReadme()
Exit Sub
End If
%>
<table border="0" cellspacing="1" cellpadding="5" height="1" align=center width="95%" class="tableBorder">
<form action="Admin_data.asp?action=CompressData" method="post">
<tr>
<td class="forumrow" height=25><b>注意:</b><br>输入数据库所在相对路径,并且输入数据库名称(正在使用中数据库不能压缩,请选择备份数据库进行压缩操作) </td>
</tr>
<tr>
<td class="forumrow">压缩数据库:<input type="text" name="dbpath" value=Data\dvbbs7.MDB>
<input type="submit" value="开始压缩"></td>
</tr>
<tr>
<td class="forumrow"><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 Ifend sub'=====================压缩参数=========================
Function CompactDB(dbPath, boolIs97)
Dim fso, Engine, strDBPath,JET_3X
strDBPath = left(dbPath,instrrev(DBPath,"\"))
Set fso = CreateObject("Scripting.FileSystemObject")If fso.FileExists(dbPath) Then
fso.CopyFile dbpath,strDBPath & "temp.mdb"
Set Engine = CreateObject("JRO.JetEngine") If boolIs97 = "True" Then
Engine.CompactDatabase "
rovider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & "temp.mdb", _
"
rovider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & "temp1.mdb;" _
& "Jet OLEDB:Engine Type=" & JET_3X
Else
Engine.CompactDatabase "
rovider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & "temp.mdb", _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & "temp1.mdb"
End Iffso.CopyFile strDBPath & "temp1.mdb",dbpath
fso.DeleteFile(strDBPath & "temp.mdb")
fso.DeleteFile(strDBPath & "temp1.mdb")
Set fso = nothing
Set Engine = nothing CompactDB = "你的数据库, " & dbpath & ", 已经压缩成功!" & vbCrLfElse
CompactDB = "数据库名称或路径不正确. 请重试!" & vbCrLf
End IfEnd Function
作者:
jinying
时间:
2005-7-15 18:12
[em05][em05]
作者:
bpchan
时间:
2008-11-24 15:17
标题:
学习!!!
学习!!!
作者:
shuts32
时间:
2010-12-25 20:10
学习下
欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/)
Powered by Discuz! X3.3