2

I have a problem when i execute GeoProcessing in ArcEngine 10 with VB.net

  1. i had create the toolbox : Models.tbx
  2. and Model Process : disolveRoute with 2 parameters

enter image description here

My Function is :

 Sub diso()
    Dim dissolveTable As ITable = CType(featureLayerRoute, ITable)
    ' Create geoprocessor. Overwrite true will replace existing output.
    Dim gp As IGeoProcessor2 = New ESRI.ArcGIS.Geoprocessing.GeoProcessor()
    Dim trac As ITrackCancel = New CancelTracker
    Dim Result As ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult2
    Dim parameters As IVariantArray = New VarArrayClass()
    gp.SetEnvironmentValue("workspace", "Database Connections\IFE connexion.sde")
    gp.OverwriteOutput = True
    gp.AddToolbox("data\Models.tbx")
    parameters.Add(dissolveTable)
    parameters.Add("typeroute")
    Try
        Result = CType(gp.Execute("disolveRoute", parameters, trac), ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult2)
    Catch ex As COMException
        Console.WriteLine(ex.ErrorCode)
    End Try

End Sub

For the inpute feature for disolve --> featureLayerRoute :

  Dim Sp As IWorkspace = ConnectToTransactionalVersion("localhost", "sde:postgresql:localhost", "sde", "....", "....")
        featureLayerRoute.FeatureClass = featureWorkspace.OpenFeatureClass("piste_route")
        Dim layerrouteAs ILayer = featureLayerDroit
        layerroute.Name = featureLayerRoute.FeatureClass.AliasName

but when i execute this function it returned a Code ERROR -2147467259.. Please it's one Week i'm looking to solve it but Nothing :'(

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

2

the solution is :

  1. the new Model is like :

Model disolveRoute

  1. it Paramters like :

parameters for the Model

  1. the Code :

  Sub diso()

        Dim gp As GeoProcessor = New ESRI.ArcGIS.Geoprocessing.GeoProcessor()
        Dim trac As ITrackCancel = New CancelTracker
        Dim Result As ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult2
        Dim parameters As IVariantArray = New VarArrayClass()

        gp.OverwriteOutput = True
        gp.AddToolbox("data\Models.tbx")
        Dim featureWorkspace As IFeatureWorkspace = CType(Sp, IFeatureWorkspace)
        Dim featureClass As IFeatureClass = featureWorkspace.OpenFeatureClass("piste_route")
        'Dim dissolveTable As IDataset = CType(featureClass, IDataset)
        parameters.Add(featureClass)
        parameters.Add("typeroute")
        parameters.Add("C:\Users\Mounaim\AppData\Roaming\ESRI\Desktop10.0\ArcCatalog\IFE connexion.sde\sde.sde.unionPExec")
        Try
            Result = CType(gp.Execute("disolveRoute", parameters, trac), ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult2)
        Catch ex As Exception
            ExamplePrintGPErrorMessages(gp)
        End Try

    End Sub





 Public Sub ExamplePrintGPErrorMessages(ByVal gp As GeoProcessor)

        Dim sev As Object = 2
        Dim messages As String = gp.GetMessages(sev)
        System.Console.WriteLine(messages)

    End Sub
-1

Are the reference as" Imports System Imports System.Threading ' Add references to esriSystem for licensing and IVariantArray. Imports ESRI.ArcGIS.esriSystem ' Add a reference to the geoprocessing namespace. Imports ESRI.ArcGIS.Geoprocessing 'Imports ESRI.ArcGIS.Geoprocessor "

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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