Select to view content in your preferred language

row.store throwing COMException: Error HRESULT E_FAIL

162
3
11-19-2024 02:07 PM
MK13
by
Frequent Contributor

My attempt to set and save the geometry on a point layer is throwing the COMException: Error HRESULT E_FAIL error on line 24, feat.Store(). @CharlesMacleod @Wolf @UmaHarano @GKmieliauskas any ideas?

Full error message is below:

ArcGIS.Core.Data.Exceptions.GeodatabaseException: 'A geodatabase exception has occurred.'

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

 

var qf1 = new QueryFilter()
{
    SubFields = $"{acctFieldname},{siteFieldname},{grpFieldname},{shapeFieldname}",
};
using (var gdb = new Geodatabase(new FileGeodatabaseConnectionPath(new Uri(gdbPath))))
using (var iphFc = gdb.OpenDataset<FeatureClass>(IfpHTableName))
using (var cursor1 = iphFc.Search(qf1, false))
{
    while (cursor1.MoveNext())
    {
        using (var feat = cursor1.Current as Feature)
        {
            var shape = feat.GetShape();
            var acctValue = Convert.ToString(feat[acctFieldname]);
            var siteValue = Convert.ToString(feat[siteFieldname]);
            var grpValue = Convert.ToString(feat[grpFieldname]);
            var asgValue = $"{acctValue}_{siteValue}_{grpValue}";
            if (geocodedAsgsWshape.ContainsKey(asgValue))
            {
                var newShape = geocodedAsgsWshape[asgValue];
                if (!newShape.Equals(shape))
                {
                    feat.SetShape(geocodedAsgsWshape[asgValue]);
                    feat.Store();
                }
            }
        }
    }
}

 

 

 

Tags (3)
0 Kudos
3 Replies
GKmieliauskas
Esri Regular Contributor

Hi,

You could use Row.Store method without EditOperation callback only in OnRowChangedEvent implementation. More information here. There are not so many cases which need Store using.

0 Kudos
MK13
by
Frequent Contributor

The linked documentation states that you only need to utilise the edit operation callback when performing edits that span both GIS and non-GIS data. I am only updating GIS data so I assumed that I don't need to use a callback.

0 Kudos
GKmieliauskas
Esri Regular Contributor

I have checked all Esri Community samples. There are 3 cases of using Store method. First method using inside EditOperation callback. Second method uses Store inside Geodatabase.ApplyEdits (sample MemoryGeodatabase). And third one as I wrote above is using Store in Row events without additional requirements (sample ModifyNewlyAddedFeatures). Rest of Store samples (6 from 😎 use first method.

I used Store method in my first add-ins, but now there is no Store usage in my code. It seems that is similar solution as in  ArcObjects but it works different.

0 Kudos