ArcEngine打开、保存图层编辑
在添加字段时,先打开图层编辑,添加之后再保存编辑
using ESRI.ArcGIS.Geodatabase;
using ESRI.ArcGIS.Controls;
public void OpenEditor(IFeatureLayer s, AxMapControl a)
{
private IEngineEditor pEngineEditor = new EngineEditorClass();
IDataset pid = s.FeatureClass as IDataset;
IWorkspace pWorkspace = pid.Workspace;
if (pWorkspace.Type == esriWorkspaceType.esriRemoteDatabaseWorkspace)
{
pEngineEditor.EditSessionMode = esriEngineEditSessionMode.esriEngineEditSessionModeVersioned;
}
else
{
pEngineEditor.EditSessionMode = esriEngineEditSessionMode.esriEngineEditSessionModeNonVersioned;
}
//开启编辑任务
pEngineEditor.StartEditing(pWorkspace, a.Map);
//保存图层编辑
pEngineEditor.StopEditing(true);
}