_SFRMPSelectionSet.Update(null, false, out pCursor); if (pCursor == null) { return false; } pRow = pCursor.NextRow(); while (pRow != null) { foreach (var pair in dictFieldsValues) { fldIndex = _SFRMPFeatureLayer.FeatureClass.Fields.FindField(pair.Key); objectValue = pair.Value; pRow.set_Value(fldIndex, objectValue); } pCursor.UpdateRow(pRow); pRow = pCursor.NextRow();
_SFRMPSelectionSet.Search(null, false, out pCursor); if (pCursor == null) {return false; } pRow = pCursor.NextRow(); while (pRow != null) { foreach (var pair in dictFieldsValues) { fldIndex = _SFRMPFeatureLayer.FeatureClass.Fields.FindField(pair.Key); objectValue = pair.Value; pRow.set_Value(fldIndex, objectValue); } pRow.Store(); pRow = pCursor.NextRow();
This post has been very helpful. I had the same error but not for the same reason.
I found two ways to successfully edit the attributes and would like to know which way is better.
This one uses Update:_SFRMPSelectionSet.Update(null, false, out pCursor); if (pCursor == null) { return false; } pRow = pCursor.NextRow(); while (pRow != null) { foreach (var pair in dictFieldsValues) { fldIndex = _SFRMPFeatureLayer.FeatureClass.Fields.FindField(pair.Key); objectValue = pair.Value; pRow.set_Value(fldIndex, objectValue); } pCursor.UpdateRow(pRow); pRow = pCursor.NextRow();
This one uses Store:_SFRMPSelectionSet.Search(null, false, out pCursor); if (pCursor == null) {return false; } pRow = pCursor.NextRow(); while (pRow != null) { foreach (var pair in dictFieldsValues) { fldIndex = _SFRMPFeatureLayer.FeatureClass.Fields.FindField(pair.Key); objectValue = pair.Value; pRow.set_Value(fldIndex, objectValue); } pRow.Store(); pRow = pCursor.NextRow();
Thank you so much.
When working with simple features and edit sessions in an Engine application, it's recommended that a search cursor be used to take advantage of batched updates in edit operations. Outside of edit sessions, an update cursor allows performance and error handling advantages. With complex features, on the other hand, update calls are overridden by the features' custom behavior, meaning that the feature's store method will be called even if an update cursor is used.