AnsweredAssumed Answered

Class is not licensed for use (Exception from HRESULT: 0x80040112)

Question asked by shlomy.akons on Feb 21, 2018

I have layer (feature class) in ArcGIS. The data is on Oracle 11g.

I try to update a field in a row but when I do feature.store I get an error

"Class is not licensed for use (Exception from HRESULT: 0x80040112)"

The code I use:

private void UpdateFeatures(IFeatureClass featureClass, IFeatureWorkspace featureWorkspace, List<FeatureValue> featureValues)    {        IFeatureCursor featureSearchCursor = null;        IWorkspaceEdit workspaceEdit = null;        try        {            workspaceEdit = (IWorkspaceEdit)featureWorkspace;            workspaceEdit.StartEditing(false);             // Start an edit operation and create a cursor.            workspaceEdit.StartEditOperation();             //IQueryFilter queryFilter = new QueryFilter();            //queryFilter.WhereClause = "Code = '" + featureValues[i].FieldName + "'";            //queryFilter.SubFields = "COMMENTS";             featureSearchCursor = featureClass.Search(null, false);            int fieldCodeIndex = featureClass.FindField("CODE");            int fieldIndex = featureClass.FindField("MODEL");             bool FieldEditable = featureWorkspace.OpenTable("Switch").Fields.get_Field(fieldIndex).Editable;             // Iterate through the features, updating the Type values.             IFeature feature = null;             while ((feature = featureSearchCursor.NextFeature()) != null)            {                object obj = feature.get_Value(fieldCodeIndex);                if (!(obj is DBNull))                {                    FeatureValue featureValue = featureValues.Where(x => x.FieldName == obj.ToString()).FirstOrDefault<FeatureValue>();                    if (featureValue != null)                    {                        int val = featureValue.FieldValue;                    }                    object obj1 = "123";                    feature.set_Value(fieldIndex,obj1);                    feature.Store();                    break;                }                 //Console.WriteLine("The new type: {0}", feature.get_Value(fieldIndex));            }        }        catch (COMException ex)        {            // Handle any errors that might occur on NextFeature().            richTextBox1.AppendText(ex.Message);        }        catch (Exception ex)        {            //handle general Errors            richTextBox1.AppendText(ex.Message);        }        finally        {            workspaceEdit.StopEditOperation();            // Stop the edit session.            workspaceEdit.StopEditing(true);            // Stop the edit operation.             // Since the edit operation is ending, release the cursor.            Marshal.ReleaseComObject(featureSearchCursor);        }    }

Attachments

Outcomes