AnsweredAssumed Answered

EditOperation .Modify method is not working as expected. What am I missing here?

Question asked by srbricker on Jul 16, 2018
Latest reply on Jul 17, 2018 by srbricker

The following code sample should write the string "Test" to the "ROW_Notes" field for the first 200 object IDs of the Centerlines feature class. The code outputs the street's full name via the debugging console, so I know that I have a good database connection and the row cursor is functioning as expected. Clearly I am missing something as the string "Test" is not written to the "ROW_Notes" field. When I run this sample, the Edit tab does not even register that an edit operation has taken place (i.e. the save and discard buttons remain grayed out.) Any thoughts as to what I am missing here?  Thanks for looking!



            await QueuedTask.Run(() =>
                DatabaseConnectionProperties connectionProperties = new DatabaseConnectionProperties(EnterpriseDatabaseType.SQLServer){...}
                Geodatabase Landbase = new Geodatabase(connectionProperties);
                FeatureClass centerLines = Landbase.OpenDataset<FeatureClass>("Transportation.DBO.Cntlr_l");

                var qf = new QueryFilter() { WhereClause = "OBJECTID < 201" };
                var cursor = centerLines.Search(qf);
                var op = new EditOperation { Name = "Street Utility" };

                while (cursor.MoveNext())
                    Row row = cursor.Current;
                    string fullName = row["FULLNAME"].ToString();
                    op.Modify(row, "ROW_Notes", "Test");
                    //row.Store(); - Exception -



As a follow up question, anytime I try to use the row.Store() method, I get an exception stating : 'Objects in this object class cannot be updated outside of an edit session.' How does one properly implement the row.Store(); method? I am having difficulty finding an example of how that method is used in the snippets / examples. A brief example would be greatly appreciated.