3

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?

2
  • Have you tried leaving off the call to workspaceEdit.StartEditing(true). I think muWorkspaceEdit.StartMultiuserEditing(esriMultiuserEditSessionMode.esriMESMVersioned) is all you should need.
    – travis
    Commented Mar 22, 2013 at 17:57
  • I tried without the call workspaceEdit.StartEditing(true) and still get the same exception :(
    – leinad13
    Commented Mar 25, 2013 at 10:44

1 Answer 1

2

You'll need to use IMultiuserWorkspaceEdit in combination with IWorkspaceEdit:

You'll need to specify whether the featureclass to edit is versioned or not:

muWorkspaceEdit.StartMultiuserEditing(esriMultiuserEditSessionMode.esriMESMVersioned);

or

muWorkspaceEdit.StartMultiuserEditing(esriMultiuserEditSessionMode.esriMESMNonVersioned);

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.