POST
|
Here is the VB.NET code; Dim strfcname As String = "" Dim GP As Geoprocessor Dim CopyFeatures As ESRI.ArcGIS.DataManagementTools.CopyFeatures Dim DeleteLayer As ESRI.ArcGIS.DataManagementTools.Delete Dim ITrack As ESRI.ArcGIS.esriSystem.ITrackCancel = Nothing Dim copied As Integer = 0 strfcname = row("FCNAME").ToString LogDetails("Append " & strfcname & " from Mobile Server FGDB to " & PersonalGeodatbaseName & "\Geographics_GDA94_srid5\" & strfcname) GP = New Geoprocessor GP.OverwriteOutput = True Try LogDetails("Deleting " & strfcname & " from " & PersonalGeodatbaseName) DeleteLayer = New ESRI.ArcGIS.DataManagementTools.Delete() DeleteLayer.in_data = PersonalGeodatbaseName & "\Geographics_GDA94_srid5\" & strfcname 'DeleteLayer.data_type = "" 'DeleteLayer.out_results = "" RunTool(GP, DeleteLayer, ITrack) LogDetails("Delete of " & strfcname & " from " & PersonalGeodatbaseName & " completed") Catch ex As Exception Return False LogDetails("Error trying to delete " & strfcname & " - " & ex.Message) End Try GP = New Geoprocessor GP.OverwriteOutput = True Try LogDetails("Copying " & strfcname & " to " & PersonalGeodatbaseName) CopyFeatures = New ESRI.ArcGIS.DataManagementTools.CopyFeatures() CopyFeatures.in_features = strfcname CopyFeatures.out_feature_class = PersonalGeodatbaseName & "\Geographics_GDA94_srid5\" & strfcname 'CopyFeatures.config_keyword = "" 'CopyFeatures.spatial_grid_1 = 0 'CopyFeatures.spatial_grid_2 = 0 'CopyFeatures.spatial_grid_3 = 0 RunTool(GP, CopyFeatures, ITrack) LogDetails("Copying of " & strfcname & " to " & PersonalGeodatbaseName & " completed") copied = copied + 1 Catch ex As Exception Return False LogDetails("Error trying to copy " & strfcname & " - " & ex.Message) End Try I keep getting this error when ever I try using the Geoprocessor; Error HRESULT E_FAIL has been returned from a call to a COM component. I am using Visual Studio 2010 - .Net Framework 3.5 - AnyCPU - ArcGIS Desktop 10.2.1 (Product Version: 10.2.1.3497) With the standard RunTool; Public Sub RunTool(ByVal geoprocessor As Geoprocessor, ByVal process As IGPProcess, ByVal TC As ITrackCancel) ' Set the overwrite output option to true geoprocessor.OverwriteOutput = True Try geoprocessor.Execute(process, Nothing) ReturnMessages(geoprocessor) Catch err As Exception LogDetails("**Error Executing Geoprocessor for " & process.ToolboxName & " - " & err.Message) ReturnMessages(geoprocessor) End Try End Sub Public Sub ReturnMessages(ByVal gp As Geoprocessor) ' Print out the messages from tool executions Dim Count As Integer If gp.MessageCount > 0 Then For Count = 0 To gp.MessageCount - 1 If Count = gp.MessageCount - 1 Then LogDetails(gp.GetMessage(Count)) End If Next End If End Sub
... View more
10-02-2014
11:31 PM
|
0
|
0
|
2719
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|