How to delete an existing ITable in inMemoryWorkspace

12-18-2012 11:51 PM
New Contributor III
Hi together!

I'm trying to delete an ITable in an inMemoryWorkspace but the following code doesn't work:

 Public Sub deleteTableInWorkspace(ByVal pTable As ITable)
        Dim pDataset As IDataset
        pDataset = pTable
        CType(managerInMemoryWorkspace, IFeatureWorkspaceManage).DeleteByName(pDataset.FullName)
    End Sub

The code doesn't throw an exception but later I try to generate a new ITable with the same name:

 Dim pTable As ITable = workspace.CreateTable(ITableName, pFields, Nothing, Nothing, "")

Now I get the following exception:

"Exception from HRESULT: 0x80040353"

I debugged my code and recognize that the IName object from my generated ITable is empty. Is this the problem why the deleteTableInWorkspace method doesn't work? But how can i fill the IName object from the Tbale with values?
0 Kudos
1 Reply
New Contributor II
Have you tried the IDataset.Delete() method?
0 Kudos