Skip to main content
Added language tag
Source Link
Hornbydd
  • 45k
  • 5
  • 43
  • 84

You need a temporary workspace before setting up the geoprocessor. And in the end look for the result if job is suceededsucceeded. From the workspace you get the resultsetresult set, so you could do something with it.

// Create a scratch workspace factory. IScratchWorkspaceFactory workspaceFactory = new ESRI.ArcGIS.DataSourcesGDB.ScratchWorkspaceFactoryClass(); IScratchWorkspaceFactory2 workspaceFactory2 = workspaceFactory as IScratchWorkspaceFactory2; // Get the default scratch workspace. IWorkspace scratchWorkspace = null; try { if (workspaceFactory2.CurrentScratchWorkspace != null) scratchWorkspace = workspaceFactory2.CurrentScratchWorkspace; else scratchWorkspace = workspaceFactory2.DefaultScratchWorkspace; } catch (Exception ex) { MessageBox.Show("..."); return; } // Fill your parameters here.. // Execute the tool. ITrackCancel trac = new ESRI.ArcGIS.Display.CancelTracker(); try { ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult resi = gp.Execute(Merge_management", parameters, trac); if (resi.Status == esriJobStatus.esriJobSucceeded) { try { IEnumDataset arDs = scratchWorkspace.get_Datasets(esriDatasetType.esriDTFeatureClass); if (arDs != null) {..} } catch... 
// Create a scratch workspace factory. IScratchWorkspaceFactory workspaceFactory = new ESRI.ArcGIS.DataSourcesGDB.ScratchWorkspaceFactoryClass(); IScratchWorkspaceFactory2 workspaceFactory2 = workspaceFactory as IScratchWorkspaceFactory2; // Get the default scratch workspace. IWorkspace scratchWorkspace = null; try { if (workspaceFactory2.CurrentScratchWorkspace != null) scratchWorkspace = workspaceFactory2.CurrentScratchWorkspace; else scratchWorkspace = workspaceFactory2.DefaultScratchWorkspace; } catch (Exception ex) { MessageBox.Show("..."); return; } // Fill your parameters here.. // Execute the tool. ITrackCancel trac = new ESRI.ArcGIS.Display.CancelTracker(); try { ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult resi = gp.Execute(Merge_management", parameters, trac); if (resi.Status == esriJobStatus.esriJobSucceeded) { try { IEnumDataset arDs = scratchWorkspace.get_Datasets(esriDatasetType.esriDTFeatureClass); if (arDs != null) {..} } catch... 

You need a temporary workspace before setting up the geoprocessor. And in the end look for the result if job is suceeded. From the workspace you get the resultset, so you could do something with it.

// Create a scratch workspace factory. IScratchWorkspaceFactory workspaceFactory = new ESRI.ArcGIS.DataSourcesGDB.ScratchWorkspaceFactoryClass(); IScratchWorkspaceFactory2 workspaceFactory2 = workspaceFactory as IScratchWorkspaceFactory2; // Get the default scratch workspace. IWorkspace scratchWorkspace = null; try { if (workspaceFactory2.CurrentScratchWorkspace != null) scratchWorkspace = workspaceFactory2.CurrentScratchWorkspace; else scratchWorkspace = workspaceFactory2.DefaultScratchWorkspace; } catch (Exception ex) { MessageBox.Show("..."); return; } // Fill your parameters here.. // Execute the tool. ITrackCancel trac = new ESRI.ArcGIS.Display.CancelTracker(); try { ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult resi = gp.Execute(Merge_management", parameters, trac); if (resi.Status == esriJobStatus.esriJobSucceeded) { try { IEnumDataset arDs = scratchWorkspace.get_Datasets(esriDatasetType.esriDTFeatureClass); if (arDs != null) {..} } catch... 

You need a temporary workspace before setting up the geoprocessor. And in the end look for the result if job is succeeded. From the workspace you get the result set, so you could do something with it.

// Create a scratch workspace factory. IScratchWorkspaceFactory workspaceFactory = new ESRI.ArcGIS.DataSourcesGDB.ScratchWorkspaceFactoryClass(); IScratchWorkspaceFactory2 workspaceFactory2 = workspaceFactory as IScratchWorkspaceFactory2; // Get the default scratch workspace. IWorkspace scratchWorkspace = null; try { if (workspaceFactory2.CurrentScratchWorkspace != null) scratchWorkspace = workspaceFactory2.CurrentScratchWorkspace; else scratchWorkspace = workspaceFactory2.DefaultScratchWorkspace; } catch (Exception ex) { MessageBox.Show("..."); return; } // Fill your parameters here.. // Execute the tool. ITrackCancel trac = new ESRI.ArcGIS.Display.CancelTracker(); try { ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult resi = gp.Execute(Merge_management", parameters, trac); if (resi.Status == esriJobStatus.esriJobSucceeded) { try { IEnumDataset arDs = scratchWorkspace.get_Datasets(esriDatasetType.esriDTFeatureClass); if (arDs != null) {..} } catch... 
Source Link
Frau Schmidt
  • 1.2k
  • 9
  • 27

You need a temporary workspace before setting up the geoprocessor. And in the end look for the result if job is suceeded. From the workspace you get the resultset, so you could do something with it.

// Create a scratch workspace factory. IScratchWorkspaceFactory workspaceFactory = new ESRI.ArcGIS.DataSourcesGDB.ScratchWorkspaceFactoryClass(); IScratchWorkspaceFactory2 workspaceFactory2 = workspaceFactory as IScratchWorkspaceFactory2; // Get the default scratch workspace. IWorkspace scratchWorkspace = null; try { if (workspaceFactory2.CurrentScratchWorkspace != null) scratchWorkspace = workspaceFactory2.CurrentScratchWorkspace; else scratchWorkspace = workspaceFactory2.DefaultScratchWorkspace; } catch (Exception ex) { MessageBox.Show("..."); return; } // Fill your parameters here.. // Execute the tool. ITrackCancel trac = new ESRI.ArcGIS.Display.CancelTracker(); try { ESRI.ArcGIS.Geoprocessing.IGeoProcessorResult resi = gp.Execute(Merge_management", parameters, trac); if (resi.Status == esriJobStatus.esriJobSucceeded) { try { IEnumDataset arDs = scratchWorkspace.get_Datasets(esriDatasetType.esriDTFeatureClass); if (arDs != null) {..} } catch...