I am trying to delete features from a feature class but i always get this error
"Error HRESULT E_FAIL has been returned from a call to a COM component."
at this line feature.Delete();
Here is my code:
private void DeleteRecordsFromStandardDBFeatureClass()
ESRI.ArcGIS.Geodatabase.IFeatureClass destinationFeatureClass = Globals.GlobalsInstance.StandardDB.GetFeatureWorkSpaceOfDataSource().OpenFeatureClass(m_tableName);
ESRI.ArcGIS.Geodatabase.IFeatureCursor searchCursor = destinationFeatureClass.Search(null, false);
// Delete the retrieved features.
ESRI.ArcGIS.Geodatabase.IFeature feature = null;
while ((feature = searchCursor.NextFeature()) != null)
catch (Exception ex)
Logger.LoggerInstance.LogError(ex.Message, DateTime.Now, "DeleteRecordsFromStandardDBFeatureClass", "MigrationFeatureClass", m_tableName);
throw new Exception(ex.Message);