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.

I'm always having a problem in GP.execute() when trying to execute this method. Here is my code:

 Friend Function DissolveFeatures(ByVal pInFLayer As ESRI.ArcGIS.Carto.IFeatureLayer, ByVal DissolveField As String, ByVal OutName As String) As ESRI.ArcGIS.Carto.IFeatureLayer

            Dim GP As New ESRI.ArcGIS.Geoprocessor.Geoprocessor
            Dim Dissolve As ESRI.ArcGIS.DataManagementTools.Dissolve = New ESRI.ArcGIS.DataManagementTools.Dissolve
            Dim pFLayer As ESRI.ArcGIS.Carto.IFeatureLayer = New ESRI.ArcGIS.Carto.FeatureLayer

                GP.AddOutputsToMap = True
                GP.OverwriteOutput = True
                GP.SetEnvironmentValue("workspace", "Database Connections\IFE connexion.sde")

                Dissolve.in_features = pInFLayer
                Dissolve.dissolve_field = DissolveField
                Dissolve.out_feature_class = "Database Connections\IFE connexion.sde\" & OutName

                RunTool(GP, Dissolve, Nothing)

                pFLayer.FeatureClass = CType(GP.Open(OutName), IFeatureClass)
                pFLayer.Name = pFLayer.FeatureClass.AliasName

            Catch ex As Exception
                MsgBox(ex.Message & "Dissolve Features")
            End Try

            Return pFLayer

        End Function

Private Shared Sub RunTool(ByVal geoprocessor As ESRI.ArcGIS.Geoprocessor.Geoprocessor, ByVal process As IGPProcess, ByVal TC As ITrackCancel)

        ' Set the overwrite output option to true
        geoprocessor.OverwriteOutput = True

            geoprocessor.Execute(process, Nothing)

        Catch err As Exception
        End Try
    End Sub

    ' Function for returning the tool messages.
    Private Shared Sub ReturnMessages(ByVal gp As ESRI.ArcGIS.Geoprocessor.Geoprocessor)
        ' Print out the messages from tool executions
        Dim Count As Integer
        If gp.MessageCount > 0 Then
            For Count = 0 To gp.MessageCount - 1
        End If
    End Sub

This returns an error:

Error HRESULT E_FAIL has been returned from a call to a COM component

Please help.

share|improve this question
this line Dissolve.out_feature_class = "Database Connections\IFE connexion.sde\" & OutName it s not catched by the compiler ? –  geogeek Apr 11 '13 at 10:44
proplem is when he want to execute Geoprocessor on line geoprocessor.Execute(process, Nothing) –  AbdelMounaim TAOUSSI Apr 11 '13 at 13:06

Your Answer


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

Browse other questions tagged or ask your own question.