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

4216
7
Jump to solution
03-12-2012 04:04 AM
ShaningYu
Frequent Contributor
I am working on an ArcObjects tool (for Desktop application) that was before for V9.3, but failed in V10.0.  I received such an error message:
Error HRESULT E_FAIL has been returned from a call to a COM component.  ???
at        mFeatCur = mFeatClass.Update(mQFeatures, false);
where   mFeatClass is an IFeatureClass, mFeatCur  is  an  IFeatureCursor.
I checked the references and found nothing is missing.
If you have any idea for this issue, please share.  Thanks.
0 Kudos
1 Solution

Accepted Solutions
ShaningYu
Frequent Contributor
Problem solved.  It is due to the query WhereClause format.  The value of the field should be integer.  I changed 
    mQFeatures.WhereClause = string.Format("{0} = '{1}'", ripCycleColField, currCycle);
to
    mQFeatures.WhereClause = string.Format("{0} = {1}", ripCycleColField, currCycle);
Then, it works.  Thanks to those who spent time to view and reply my post.

View solution in original post

0 Kudos
7 Replies
NeilClemmons
Regular Contributor III
The problem is most likely the query filter you're passing into the Update method.  Make sure the SQL syntax is correct, that everything is spelled correctly and that any fields you're naming exist in the feature class.
0 Kudos
ShaningYu
Frequent Contributor
The query filter is correct:  myQFeatures.WhereClause = "RIP_CYCLE = '3'".  I checked by running the definition-query in the mxd.  I was told that this program used to work in V9.3.  But it failed in V10.0.
0 Kudos
NeilClemmons
Regular Contributor III
If the query is correct then it might be something else related to the data because there's nothing wrong with the code you posted as far as I can see.  Could it be a permissions issue?  Your code is getting an Update cursor so is an edit session necessary for the type of data you're going to be editing?  Does the feature class participate in a network, topology or something like that?  Can you start an edit session on this feature class in ArcMap?
0 Kudos
ShaningYu
Frequent Contributor
I loaded some shapefiles.  They are editable as tried in ArcMap by start and stop editing.  The shapefile's time-stamp changes after my editing.
Neither network nor topology is involved.  Really don't know what heppens.  Thanks.
0 Kudos
sapnas
by
Occasional Contributor III
E-FAIL is a very generic error.  get the comexception error code and look it up in the below link. I hope this helps.

http://edndoc.esri.com/arcobjects/9.1/ComponentHelp/esriGeoDatabase/fdoError.htm
0 Kudos
DuncanHornby
MVP Notable Contributor
Just an idea (without seeing the whole code) but with the cursor have you set SubFields property and not included "RIP_CYCLE" by mistake?
0 Kudos
ShaningYu
Frequent Contributor
Problem solved.  It is due to the query WhereClause format.  The value of the field should be integer.  I changed 
    mQFeatures.WhereClause = string.Format("{0} = '{1}'", ripCycleColField, currCycle);
to
    mQFeatures.WhereClause = string.Format("{0} = {1}", ripCycleColField, currCycle);
Then, it works.  Thanks to those who spent time to view and reply my post.
0 Kudos