English

Problem: Feature editing fails in an editable layer

Description

When editing layers, features from an editable layer are not editable.

Cause

When using query filter, only a subset of fields contained in the feature layer is returned. For example:

Code:

using (FeatureDataReader reader = featureLayer.GetDataReader(new QueryFilter(new Envelope(e.MapCoordinate,
map1.ToMap(3),map1.ToMap(3)), EsriGeometricRelationship.Intersect),"tempfield", featureLayer.GeometryColumnName))
{
if (reader.Read())
{
reader.SetInt32(reader.GetOrdinal("tempfield"), 1); // throws an exception
reader.Update();
}
}

Solution or Workaround

To avoid this problem, do not restrict attribute fields to be returned within a query. For example:

Code:

using (FeatureDataReader reader = featureLayer.GetDataReader(new QueryFilter(new Envelope(e.MapCoordinate,
map1.ToMap(3),map1.ToMap(3)), EsriGeometricRelationship.Intersect)))
{
if (reader.Read())
{
reader.SetInt32(reader.GetOrdinal("tempfield"), 1);
reader.Update();
}
}