Hi,
I am also facing the same issue while updating the feature. Everything goes fine until the code reaches feature.store().
It throws "Class is not licensed for use (Exception from HRESULT: 0x80040112)" error.
I have tried initializing the ArcFM license as well as suggested in above link. But it is not working for me. 😞
I m posting my code. Any help will be appriciated.
IFeatureWorkspace pFeatureWorkspace = null;
IWorkspace pWorkSpace = null;
try
{
pWorkSpace = GetWorkSpace(strSdeVersionName);
pFeatureWorkspace = pWorkSpace as IFeatureWorkspace;
// Open the feature class to rematch.
IFeatureClass featureClass = pFeatureWorkspace.OpenFeatureClass(strFeatureClassName);
IWorkspaceEdit workspaceEdit = pFeatureWorkspace as ESRI.ArcGIS.Geodatabase.IWorkspaceEdit;
bool isBeingEdited = workspaceEdit.IsBeingEdited();
if (isBeingEdited)
{
throw new Exception("Workspace is already being edited");
}
workspaceEdit.StartEditing(false);
workspaceEdit.StartEditOperation();
try
{
ESRI.ArcGIS.Geodatabase.IQueryFilter pQueryFilter = (IQueryFilter)pSvrContext.CreateObject("esriGeoDatabase.QueryFilter");
pQueryFilter.WhereClause = strWhereClause;
ESRI.ArcGIS.Geodatabase.IFeatureCursor pFeatureCursor = featureClass.Search(pQueryFilter, false);
ESRI.ArcGIS.Geodatabase.IFeature pFeature = pFeatureCursor.NextFeature();
if (pFeature == null)
{
throw new Exception("Feature with " + strWhereClause + "could not be found/edited.");
}
while (pFeature != null)
{
foreach (KeyValuePair<string, string> keyValue in fieldValuePair)
{
pFeature.set_Value(pFeature.Fields.FindField(keyValue.Key), keyValue.Value);
}
pFeature.Store(); //Error is thrown at this line
if (UpdateOneFeatureOnly)
break;
pFeature = pFeatureCursor.NextFeature();
}
if (pFeatureCursor != null)
System.Runtime.InteropServices.Marshal.ReleaseComObject(pFeatureCursor);
workspaceEdit.StopEditOperation();
workspaceEdit.StopEditing(true);