Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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?

share|improve this question
    
Have you tried leaving off the call to workspaceEdit.StartEditing(true). I think muWorkspaceEdit.StartMultiuserEditing(esriMultiuserEditSessionMode.esriMESMVersi‌​oned) is all you should need. –  travis Mar 22 '13 at 17:57
    
I tried without the call workspaceEdit.StartEditing(true) and still get the same exception :( –  leinad13 Mar 25 '13 at 10:44

1 Answer 1

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);
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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