File GDB feature class editing problem

451
2
Jump to solution
03-22-2013 04:36 AM
Highlighted
New Contributor III
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. Any thougts? My code:
[PHP]
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)
        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
[/PHP]

Thanks in advance 🙂
0 Kudos
1 Solution

Accepted Solutions
Highlighted
New Contributor III
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)

View solution in original post

0 Kudos
2 Replies
Highlighted
New Contributor III
Still haven't figured it out.. 🙂 Forgot to mention that error occurs after this statement:
[PHP]
Dim featureCursor As IFeatureCursor = featureClass.Insert(True)
[/PHP]
0 Kudos
Highlighted
New Contributor III
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)

View solution in original post

0 Kudos