Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

The code I am writing for a button (ArcObjects 9.2, Visual Studio 2005) takes the attributes for selected points in a shapefile and writes them to a table:

Dim pGp As GeoProcessor = New GeoProcessor
pGp.OverwriteOutput = True
Dim pParams As IVariantArray = New VarArrayClass
...
Dim strFolderName As String = "C:\temp"
Dim strTableName As String = "TandE_data2.dbf"
With pParams
    .RemoveAll()
    .Add(pTELayer) 'A point SHP with at least one feature selected
    .Add(strFolderName) '("in_memory")
    .Add(strTableName) '("TandE_data2")
End With
pGp.Execute("TableToTable_conversion", pParams, Nothing)

As written, the process will fail at the pGp.Execute statement on the third execution, with the message

A first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in SDtools.dll

appearing in Visual Studio's output window. If the output is directed to an in_memory workspace table instead of a DBF (using the values seen in the code comments), the code always runs to completion.

What changes do I need to make to the code for it to output to a DBF consistantly?

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

I discovered that using TableToDBASE instead of TableToTable doesn't cause the same error. I had to jump through a couple of extra hoops to get the table named right, but now I can run the code at least 10 times without getting an error.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.