I am in Arc10.0 using VB.net. trying to use the GP tool JoinField as shown below, but it keeps giving "Runtime.InteropServices.COMException (0x80004005)" ERRORS. I have used other GP tools just fine. FYI, below I have also tried adding the tables as objects and without the .dbf extension with no luck.
Public Function Test_GP2()
' Create geoprocessor. Overwrite true will replace existing output.
Dim pJoin As ESRI.ArcGIS.DataManagementTools.JoinField Dim Result As ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult
Try
' Execute the tool pJoin = New ESRI.ArcGIS.DataManagementTools.JoinField pJoin.in_data = "C:\_Debbie\GapTool\Results\2\3S_3\Output\3S_3\E_3S_3.dbf" pJoin.in_field = "VALUE" pJoin.join_table = "V:\Natural_Resources\LandCover2000\LV2000\LV2000.dbf" pJoin.join_field = "UNIQUE_ID"
Result = RunTool(pJoin, Nothing)
Catch ex As Exception MsgBox("ERROR: " & m_Current_Address & " - Export table - " & " " & ex.Message)
Finally pJoin = Nothing Result = Nothing End Try
End Function
Public Function RunTool(ByVal Process As ESRI.ArcGIS.Geoprocessor.IGPProcess, ByVal TC As ESRI.ArcGIS.esriSystem.ITrackCancel) As ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult
Dim Result As ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult Dim GP As ESRI.ArcGIS.Geoprocessor.Geoprocessor = New ESRI.ArcGIS.Geoprocessor.Geoprocessor() Try
Result = CType(GP.Execute(Process, Nothing), ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult) If Result.Status <> ESRI.ArcGIS.esriSystem.esriJobStatus.esriJobSucceeded Then MsgBox("error") 'ReturnMessages() GP.ClearMessages() Catch ex As Exception
System.Windows.Forms.MessageBox.Show(ex.ToString, "Run Geoprocessor") End Try
thanks for all your input, I am doing all the binding necessary for Engine, it was just this GP tool I had trouble with. Anyway, I figured it out. I have to pass in an object, table, not the literal string for the table. so all good now.
interesting question, but they are both integers. I have used the exact same parameters in ArcToolBox to perform this task, so I know this should work. THis is in arcEngine, in case that matters.
I have yet to develop an engine application but I know one needs to initialize ArcObjects as the first thing you must do before calling any ArcObjects, have you done this? Look on the forums for IAoInitialize. Whilst searching I found references to Binding to RuntimeManager not sure if you need to do that to?
thanks for all your input, I am doing all the binding necessary for Engine, it was just this GP tool I had trouble with. Anyway, I figured it out. I have to pass in an object, table, not the literal string for the table. so all good now.