Compacting an Access database from ASP code
Published on 6/13/2008 by Dotnetindex|
Vote this tutorial:
|
More articles in ASP
This source code can compact and repair your MS-Access database files. If you compact your access files regularly, it will work more faster and secure. Also you will save some hard disk space.
<%
oldFile = Server.MapPath("db.mdb")
newFile = Server.MapPath("bak.mdb")
strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="& oldFile
strConnBak = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & newFile
Set objJRO = Server.CreateObject("JRO.JetEngine")
objJRO.CompactDatabase strConn, strConnBak
Set objJRO = Nothing
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(newFile) And objFSO.FileExists(oldFile) Then
objFSO.DeleteFile(oldFile)
objFSO.MoveFile newFile, oldFile
Response.Write "Compact and Repair was successful."
Else
Response.Write "Compact and Repair failed."
End If
Set objFSO = Nothing
%>
no comments submitted
Latest Posts
- Create and retrieve cookies
- Easy Error Handling in C#
- Filtering results from database
- Filling Data into Select List
- Working with Array Remove An Item
- Custom Paging in ASP Fast And Easy
- Display Top N records from MS Access
- Using GetRows To Get All Records From Table
- VBScript Functions The Len Function
- Free User Registration Form
- Copying Folders using File System Object
- ArrayList object usage with example
- Using SUM Function in An SQL Statement
- Compacting an Access database from ASP code
- Database Driven Login Script
- Methods of Session Object
- Simple XMLRSS Parser Part-II
- Selecting random record from database
- Image downloading from remote servers in ASP
- How to Encrypt String Using MD5


