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?