[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 199
  • Last Modified:

Compact Repair Database (Close Database)

I have the code to compact and repair a database. But I receive the error 3356 the database is open.. What is the best way to close the database, if it is open. I have tried db.Close but it must be open somewhere else in the project.  Any suggestions?
0
TEALTEAL
Asked:
TEALTEAL
1 Solution
 
danlevansCommented:
I just had a problem similar. The corruption caused the database to think someone had it open when they didn't.
Try renaming the database to a different name. Then restore from backup.

If you can't rename it. You will have to find out who in your network has it and clear the hold. Then run the repair.
0
 
DaveWaltonCommented:
You can try to ensure that all active recordsets are closed and set to Nothing, then set db=Nothing before trying your repair.

0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now