Repository for Ideas & Research
Open Source GIS, Hydrologic Modeling, Optimization
Tags: ,

ArcGIS

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: u-arcgis-loading-table-data-error.png

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;
}

Thu Aug 17 11:39:52 2017 EDT by Huidae Cho
Parsing time: 0.037 seconds
XHTML . CSS . Powered by Uniqki!