0

I'm trying to add new feature to file GDB feature class and keep getting this error: Objects in this class cannot be updated outside an edit session. Feature class has attachments enabled (exists relationships). Googled alot about this problem and still can't figure it out. FYI I'm developing a standalone application. My code:

Public Shared Sub CreateFeature(ByVal workspace As IWorkspace, ByVal featureClass As IFeatureClass, ByVal point As ArcGIS.Geometry.IPoint, ByVal data As String) 
 Dim workspaceEdit As IWorkspaceEdit = CType(workspace, IWorkspaceEdit) 
 workspaceEdit.StartEditing(True) 
 workspaceEdit.StartEditOperation() 
 Dim featureBuffer As IFeatureBuffer = featureClass.CreateFeatureBuffer() 
 Dim featureCursor As IFeatureCursor = featureClass.Insert(True) ' <- at this point error occurs
 Dim featureOID As Object 
 featureBuffer.Value(featureBuffer.Fields.FindField("Data")) = data 
 featureBuffer.Shape = point 
 featureOID = featureCursor.InsertFeature(featureBuffer) 
 featureCursor.Flush() 
 workspaceEdit.StopEditOperation() 
 workspaceEdit.StopEditing(True) 
End Sub 
asked Mar 24, 2013 at 14:02
4
  • What error are you getting? Did you try calling IFeatureClass.Insert(false) instead? Is this a standalone exe, if so are you initializing the license? What license level are you at? Can you successfully edit the featureclass with arcmap? Commented Mar 24, 2013 at 15:27
  • The error is: Objects in this class cannot be updated outside an edit session. If I call IFeatureClass.Insert(false) I get the same error. This is a standalone exe and I am initializing the license on startup. I am at ArcInfo license (ArcGIS 10). I can edit the featureclass with ArcMap. Commented Mar 25, 2013 at 6:08
  • Do you get an error with featureClass.CreateFeature(), then calling IFeature.Store() ? Commented Mar 25, 2013 at 13:20
  • same problem with featureClass.CreateFeature(), then calling IFeature.Store() Commented Mar 25, 2013 at 14:22

1 Answer 1

0

Figured it out. It was a license binding issue. I was using: ESRI.ArcGIS.RuntimeManager.BindLicense(ProductCode.Desktop)

instead of: ESRI.ArcGIS.RuntimeManager.BindLicense(ProductCode.Desktop, LicenseLevel.GeodatabaseUpdate)

answered Apr 5, 2013 at 5:53

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.