Forums

ASP

This topic is locked

Compress Database

Posted 12 Nov 2002 09:35:12
1
has voted
12 Nov 2002 09:35:12 agoes Setiawan posted:
How do I Compress my Database with password (MS Access Database).
Script Below was done if my database unlock with password protection, but when it lock...
I've got an error :
Microsoft JET Database Engine error '80040e4d'
Cannot start your application. The workgroup information file is missing or opened exclusively by another user.

Please help ...



<%@ TRANSACTION=Required LANGUAGE="VBScript" %>
<%Option Explicit%>


<HTML>
<HEAD>
<TITLE></TITLE>
</HEAD>

<BODY bgcolor=#0000cd >

<%
dim dbFile
dim dbFileCompacted
dim fs
dim Engine


' Map current path to physical path
dbFile = Server.MapPath("db\AllData.mdb"
dbFileCompacted = Server.MapPath("db\compacted_db2.mdb"

' Create FileSytemObject Component
Set fs = Server.CreateObject("Scripting.FileSystemObject"

'Compacting dbFile, copy the result and delete dbFileCompacted
Set Engine = CreateObject("JRO.JetEngine"
engine.CompactDatabase "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="+dbFile+";User Id=admin;Password=MYPASSWORD", _
"Provider=Microsoft.Jet.OLEDB.4.0;Data ource="+dbFileCompacted+";User Id=admin;Password=MYPASSWORD"
fs.CopyFile dbFileCompacted, dbFile
fs.DeleteFile dbFileCompacted


' The Transacted Script Commit Handler. This sub-routine
' will be called if the transacted script commits.

Sub OnTransactionCommit()
Response.Write "<P> </P><P> </P><p align=center><font face=tahoma color=00ff00> <b>Database is successfully updated and compacted</b>.</font></p>"
End sub


' The Transacted Script Abort Handler. This sub-routine
' will be called if the script transacted aborts

Sub OnTransactionAbort()
Response.Write "<P> </P><P> </P><p align=center><font face=tahoma color=00ff00> <b>Database is successfully updated but compression is failed</b>.</font></p>"
end sub
%>
</BODY>
</HTML>

Reply to this topic