Periodic crashes of  update set of features of shape file

Discussion created by aviabunin on Sep 10, 2013
Latest reply on Sep 28, 2013 by aviabunin
I use arcObjects 2010 in VS 2010. From time to time I must refresh set of features. I delete all features and then create new set of fertures in accordance with the current contents of the database table. Multiple users can run copy of the program. Sometimes refreshing layer crashes. The first assumption is that I did not properly remove the existing set of features. Is this correct code:
        public void clearSetOfFeatures(string layerName)

            ESRI.ArcGIS.Geodatabase.IQueryFilter qFilter = new ESRI.ArcGIS.Geodatabase.QueryFilter();
            qFilter.WhereClause = "";
            qFilter.SubFields = "Shape";

            ESRI.ArcGIS.Geodatabase.IFeatureClass featureClass = null;
            ESRI.ArcGIS.Carto.IFeatureLayer featureLayer = getLayerByName(layerName) as ESRI.ArcGIS.Carto.IFeatureLayer;
            ESRI.ArcGIS.Geodatabase.IFeatureCursor cursor = featureLayer.Search(qFilter, true);

            featureClass = featureLayer.FeatureClass;

            ESRI.ArcGIS.Geodatabase.ITable table = (ESRI.ArcGIS.Geodatabase.ITable)featureClass;


Thanks in advance!