Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8870563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:45:54+00:00 2026-06-14T17:45:54+00:00

I am writting an ArcMap-AddIn with vb.net. I got an error when trying to

  • 0

I am writting an ArcMap-AddIn with vb.net. I got an error when trying to compact my IWorkspace(mdb), the error is:

COMException

You tried to open a database, which was already opened by the user
‘ADMIN’ on Computer ‘XXXXXX’. Try it again when the database is
available.

On ESRI.ArcGIS.Geodatabase.IDatabaseCompact.Compact() on
MyProject.MyClass.CompactGDB(IWorkspace pWS)

How can i compact the used workspace?
There are 8 other functions which also used my workspace.

Any suggestions?

The Code:

' CompactGDB
    Public Sub CompactGDB(ByVal pWS As IWorkspace)

        Dim pDatabaseCompact As IDatabaseCompact
        If (TypeOf pWS Is IDatabaseCompact) Then
            pDatabaseCompact = CType(pWS, IDatabaseCompact)
            If (pDatabaseCompact.CanCompact) Then
                Try
                    pDatabaseCompact.Compact()
                Catch ex As Exception
                    MessageBox.Show(ex.type & ex.Message & ex.StackTrace, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
                End Try    
            End If
        End If    
    End Sub
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T17:45:56+00:00Added an answer on June 14, 2026 at 5:45 pm

    Found the solution:

    Before calling the Compact() method make sure there are not any existing locks on the database.

    If it is a file geodatabase then open the gdb directory in Windows Explorer and look for LOCK type files, they end in .lock.

    For personal geodatabase there will be a .ldb file in the directory with the same name as the .mdb.

    • If you have a layer or table from the geodatabase loaded in the map
      then you will not be able to remove all locks.
    • If another user is
      accessing the geodatabase then you will not be able to remove all
      locks.
    • If you are using arcobjects to temporarily access the
      geodatabase then you need to use good practices and close any
      geodatabase resources when the calling process ends. This includes
      releasing all COM objects when you are finished with them.

    Use the ComReleaser Class in ESRI.ArcGIS.ADF.Connection.Local namespace

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writting a .NET DirectShow application which captures audio stream from any capture device,
I tried writting a function which receives an input from the user as to
I'm writting a software in C# and .NET to manage my store, which has
i'm writting an app which sends byte codes from a tablet to a µ-controler.
I'm writting a SerialPort program. Sometimes when I want to open the SerialPort, an
I'm writting an android app which has to send a picture on a wcf
I'm writting an android app which has to upload an picture throught a web
I'm writting an app which has to post some data on a webservice. To
I am writting a dashboard application in Asp.net. When I load the main page
I'm writting a program in .Net for Windows Phone 7. I have a part

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.