I am writting an ArcMap-AddIn with vb.net. I get 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 access that workspace, which i used before, to compact it?
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
I've got 8 other functions, which work with my workspace.
Any suggestions?