ArcGIS
- Develop with ArcGIS Online
- REST API Services URL for an ArcGIS Online Web Map
- AGOL-OL: ArcGIS Online (AGOL) Web Map using OpenLayers
Contents
1 Potential issues
1.1 Loading table data
I often experience this loading table data error after programmatically adding new fields to a feature class or a table while in an edit session. This error is understandable because the “Add Field...” menu in the attribute table is deactivated in an edit session. However, you can add new fields programmatically anyway, but that is not a good idea. Sometimes, I want to enforce the user to start an edit session themselves before using my application so that they know my application will make changes to their data. However, adding new fields in the same edit session often causes this error:
For example,
IEditor editor;
IWorkspace ws;
editor = (IEditor)ArcMap.Application.FindExtensionByName("ESRI Object Editor");
ws = ((IDataset)fc).Workspace;
if (editor.EditState == esriEditState.esriStateEditing) throw new ApplicationException("Must close edit sessions first.");
// must create fields outside an edit session to avoid a loading table data error
CreateFields();
try
{
editor.StartEditing(ws);
// we may not need an operation because this code snippet will exit the edit session
// by saving or discarding changes without giving the user a chance to undo
editor.StartOperation();
// make edits here
editor.StopOperation("My edits");
editor.StopEditing(true);
}
catch
{
editor.AbortOperation();
editor.StopEditing(false);
throw;
}