I want to enter some data in a feature class with ArcObjects. In my code I use EditSession for that, but in storing data an error returned that says I must use editsession. By researching I found that the feature class is non-simple data, and yesterday I find that this non-simple data option is because of creating a M-M relationship. At the end my goal is to enter data into this non-simple feature class with this code.

public string insertdata(string tablename, List<tableRow> fields, string primerykey)
        IEnumDataset datasets = ws.get_Datasets(esriDatasetType.esriDTAny);
        IDataset dataset = null;
        ITable table = null;

            IFeatureWorkspace fws = ws as IFeatureWorkspace;
            IFeatureDataset fdataset = fws.OpenFeatureDataset("Electrical");
            datasets = fdataset.Subsets;
                dataset = datasets.Next();
                table = dataset as ITable;

                if (dataset == null) return "Table not exist";

            } while (dataset.Name != tablename);

        IWorkspaceEdit ews = ws as IWorkspaceEdit;

        IRow row = null;
            string value = "123";  }
            ICursor cursor = null;
            IQueryFilter2 queryFilter = new QueryFilterClass();
            queryFilter.WhereClause = primerykey + "='" + value + "'";
            cursor = table.Search(queryFilter, false);
            row = cursor.NextRow();

        foreach (tableRow field in fields)
            Type type = field.type;
            int ind = row.Fields.FindField(field.name);
            if (ind == -1) return "Field not exist";
            row.Value[ind] = Convert.ChangeType(field.value, type);




        return "Row inserted succesfull";

This method worked on all datasets but in one of them an error returned that says: "Objects in this class cannot be updated outside an edit session."

I want to know what the difference between "simple data" and "non-simple data" is in an ArcGIS geodatabase? And how can I convert non-simple to simple data?

  • 1
    Esri doesn't really use those terms, except in the context of the Simple Data Loader. "Simple feature class" is a more common usage, but since you need to start with simple feature classes to build more complex feature datasets, "conversion" is not ever involved in that direction. – Vince Jul 12 '15 at 14:57
  • @ChrisW : I want to enteer some data to a featureclass with ArcObject. In my code i use EditSesion for that but in storing data error returned that tell i must use editsession. By carefully i find that the featureclass is non simple data and yesterday i find that this non simple data option is because of creating a M-M relationship. At the end my goal is to Enter data into this non simple featureclass with above code. – Mahdi Ahmadi Jul 13 '15 at 4:47
  • The simple/non-simple relates to the features, this has to do with geometry errors. Have a look at ITopologicalOperator3.IsSimpleEx and .Simplify to correct the geometries before inserting. help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/… Note: the topological operators go up to 6 but before you use them pay close attention to the supported interfaces and geometries that implement. ITopologicalOperator3 cannot be cast from IPoint (so you can't buffer points with it for example) – Michael Stimson Jul 17 '15 at 3:53
  • I can't help but noticing you're using tables and rows, if you've got geometries you should be using IFeatureClass and IFeature instead of ITable and IRow... update the geometry by pFeature.shape = pGeometry; before storing. What type of workspace is it? Shapefile, pGDB/fGDB, SDE? You also have errant close brackets around string value = "123";... what's up with that? – Michael Stimson Jul 17 '15 at 3:58
  • @MichaelMiles-Stimson, Thanks. Its not about geometries. I work in a sde geodatabase and that's error was related to kind of relationship to other tables. when using forward or backward massage to related table then the kind of data modified to non-simple data. But i cant understand what happened in this situation that forbid me to insert row. – Mahdi Ahmadi Aug 2 '15 at 11:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.