3

I've got some code that creates a table using OLEDB connections to an access table. I want to convert this table to a Geodatabase table, so I ask a question How do I convert an access table to a proper geodatabase table? I tried to use the code there, which threw HRESULT E_FAIL, and then after reading Blah's link about using the geoprocessor I came up with this code:

Geoprocessor GP = new Geoprocessor();

ESRI.ArcGIS.ConversionTools.TableToGeodatabase tableToGeodatabaseTool =
    new ESRI.ArcGIS.ConversionTools.TableToGeodatabase();


tableToGeodatabaseTool.Input_Table = _cSM.Geodatabase_FilePath + "\\" + TableName;
tableToGeodatabaseTool.Output_Geodatabase = _cSM.Geodatabase_FilePath;

GP.Execute(tableToGeodatabaseTool, null);

... Which also throws HRESULT E_FAIL. I'm not sure why, and I'm not sure how to go about debugging it.

This code is being run from a custom toolbar in ArcGIS. It seems like ArcGIS is locking the access database, but I assume because I'm using ArcObjects that's not the problem. Any ideas?

Edit: Here are the details to the exception that is being thrown. You will note that "inner exception" is empty; it is returned as null:

System.Runtime.InteropServices.COMException was unhandled by user code

  Message="Error HRESULT E_FAIL has been returned from a call to a COM component."

  Source="ESRI.ArcGIS.Geoprocessing"

  ErrorCode=-2147467259

  StackTrace:

   at ESRI.ArcGIS.Geoprocessing.GeoProcessorClass.Execute(String Name, IVariantArray ipValues, ITrackCancel pTrackCancel)

   at ESRI.ArcGIS.Geoprocessor.Geoprocessor.ExecuteInner(IGPProcess process, ITrackCancel trackCancel, IGeoProcessor igp, IVariantArray iva)

   at ESRI.ArcGIS.Geoprocessor.Geoprocessor.Execute(IGPProcess process, ITrackCancel trackCancel)

   at Reports.Validation.validate_StumpageValues() in C:\Users\Public\Documents\SilvAssist\Reports\Reports\Validation.cs:line 131

   at Reports.frm_Options.run_Validations() in C:\Users\Public\Documents\SilvAssist\Reports\Reports\frm_Options.cs:line 160

   at Reports.frm_Options.bgWorker_Validations_DoWork(Object sender, DoWorkEventArgs e) in C:\Users\Public\Documents\SilvAssist\Reports\Reports\frm_Options.cs:line 190

   at System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e)

   at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)

InnerException:

1

I'm wrestling with my own ArcObjects COM errors, here's an idea: put the offending code in a try block, and include a catch {COMException ce}. Then examine ce.ErrorCode. That gets you the 10-digit ArcObjects error code. Then you can try to find an ESRI document listing them all - good luck with that. Googling finds several of varying vintages, none complete - but you might get lucky. Or use the errlook.exe tool that is included with Visual Studio to look up the description for the error code. See http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#//0001000002zz000000. Best of luck!

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.