koder303

CreateRow Exception

Discussion created by koder303 on Oct 1, 2013
Hello,

I am using SDE and am trying to create a new row in a table (Table1). My table has a relationship class to a FeatureClass (FC) and another relationship to another table (Table2).

FC [1-many] Table1 and Table1 [1-many] Table2

In my code I do the following:

ESRI.ArcGIS.Geodatabase.IWorkspaceEdit workspaceEdit = null;
ESRI.ArcGIS.Geodatabase.IFeatureWorkspace featureWorkspace = (ESRI.ArcGIS.Geodatabase.IFeatureWorkspace)ws;
ESRI.ArcGIS.Geodatabase.ITable myTable = featureWorkspace.OpenTable("Table1");
workspaceEdit = (ESRI.ArcGIS.Geodatabase.IWorkspaceEdit)ws;
workspaceEdit.StartEditing(true);
workspaceEdit.StartEditOperation();
ESRI.ArcGIS.Geodatabase.IRow newTblRow = myTable.CreateRow();


The last line throws the exception "Objects in this class cannot be updated outside an edit session"

Does anyone have any idea what the issue may be? I am able to query the table for rows. I am using ProductCode.EngineOrDesktop for my runtime.

Thank you,

Outcomes