Friday, 16 August 2019

c# - Can I use an Update cursor with a versioned feature class which has attachments in ArcObjects .NET


I have a problem with my code (C# ArcObjects 10.1). We are trying to update and insert 10 - 15 rows at a time into a feature class hosted in ArcSDE 10.1 on SQL Server 2008 R2.


We have a feature class which is versioned with move edits to base and also has attachments which are photos.


I did some proof of concept code a few months back and thought I had everything working - I had tested inserting and updating a versioned feature class and inserting attachments associated with a particular feature. Looking back, I don't think I tried these at the same time - the feature class I tested inserting attachments may not have been versioned.


The issue I am facing is that my code was working fine and inserting and updating features, as soon as I added the attachment table - it stopped working and I get this error :



Objects in this class cannot be updated outside an edit session     [SDE_CSO.DBO.DefinitiveList_COPY]

at this line :


IFeatureCursor cursor = featureClass.Update(queryFilter, true);

I am starting an edit session and edit operation before attempting this :


muWorkspaceEdit = (IMultiuserWorkspaceEdit)featureWorkspace;
workspaceEdit = (IWorkspaceEdit)featureWorkspace;



muWorkspaceEdit.StartMultiuserEditing(esriMultiuserEditSessionMode.esriMESMVersioned);
workspaceEdit.StartEditing(true);
workspaceEdit.StartEditOperation();

I did some googleing around and found a few old posts on the ESRI forums about a similar using using ArcPy and ArcObjects which seemed to suggest that using an Update cursor will not work with a table which is involved in a relationship.


So my question is.... is this possible with an update cursor - if so how? If not can someone offer an alternative solution?




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...