Same Problem here when update method call error through which is show on screenshot i hope any one is figureout of my missing????
public void FindPipelineYear()
{
bool isValid = ValidateInput();
if (isValid == false)
return;
// First select all junction features in given layer
IFeatureCursor featureCursor = GetJunctionFeatures();
UpdateStatusBar("Processing ......");
//BeginInvoke((ThreadStart)delegate() { UpdateStatusBar("Processing ......"); });
// Next update all connected pipeline features
Error through here>> UpdatePipelineYears(featureCursor);
}
public IFeatureCursor GetJunctionFeatures()
{
// First select all junction features in given layer
IFeatureLayer junctLayer = (IFeatureLayer)this.m_map.get_Layer(this.cmbJunction.SelectedIndex);
IFeatureClass junctFeatureClass = junctLayer.FeatureClass;
IQueryFilter queryFilter = new QueryFilterClass();
// Thi where clause selects all features in given class, also queryFilter.WhereClause = "1=1"; can be used
queryFilter.WhereClause = "GISUTPTDS like '%Muller Tee%'";
//Apply the filter to the junction feature layer
IFeatureSelection junctSelection = (IFeatureSelection)junctLayer;
junctSelection.Clear();
junctSelection.SelectFeatures(queryFilter, esriSelectionResultEnum.esriSelectionResultNew, false);
//Fire the selection changed event
junctSelection.SelectionChanged();
//Refresh the display...
IActiveView activeView = (IActiveView)this.m_document.FocusMap;
this.m_document.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, activeView.Extent);
// Execute queryfilter
IFeatureCursor junctCursor = junctFeatureClass.Update(queryFilter, false);
return junctCursor;
// Marshal.ReleaseComObject(junctCursor);
}
junctUpdateCursor.UpdateFeature(junctFeature);
break;
case "2":
junctFeature.set_Value(year2Index, dateString);
junctFeature.set_Value(Dia2Index, Materials);
Error through here>> junctUpdateCursor.UpdateFeature(junctFeature);
break;
case "3":
junctFeature.set_Value(year3Index, dateString);
junctFeature.set_Value(Dia3Index, Materials);
junctUpdateCursor.UpdateFeature(junctFeature);
break;
case "4":
junctFeature.set_Value(year4Index, dateString);
junctFeature.set_Value(Dia4Index, Materials);
junctUpdateCursor.UpdateFeature(junctFeature);
break;
default:
break;
}
pipeFeature = pipeCursor.NextFeature();
index++;
}
// Compare dates and see if they are same or not
bool same = true;
String date = dates[0];
for (int i = 1; i < pipeCount; i++)
{
if (date != dates)
{
same = false;
break;
}
}
// Update Same field
junctFeature.set_Value(sameIndex, same.ToString());
junctUpdateCursor.UpdateFeature(junctFeature);
// Get next junction feature
junctFeature = junctUpdateCursor.NextFeature();
}
//junctFeature = junctUpdateCursor.NextFeature();
System.Runtime.InteropServices.Marshal.ReleaseComObject(junctUpdateCursor);
UpdateStatusBar("Done...... " + junctCount + " Network Junction Records Updated");
}