日期:2014-05-17  浏览次数:21006 次

Objects in this class cannot be updated outside an edit session
求救:Objects in this class cannot be updated outside an edit session
http://blog.csdn.net/mydriverc/article/details/1799749这里说的方法是:
licenseStatus = CheckOutLicensesesriLicenseProductCode.esriLicenseProductCodeEngineGeoDB
这好像是VB的方法 
而我用的C#、界面框架是wpf
arcengine版本是10.0
在程序入口app.xaml.cs获取权限的方法是:

AoInitialize aoi = new AoInitializeClass ();
esriLicenseProductCode productCode= esriLicenseProductCode.esriLicenseProductCodeEngineGeoDB;
aoi.Initialize(productCode);

但是还是提示相同的错误

具体提示错误的地方如下: 
其中提示错误的语句:IFeatureCursor pFeaCursor = fcSde.Insert(true);

public void ImportShpToSde(IFeatureClass fcShp, IWorkspace inWorkspace, IFeatureClass fcSde, Cread.Model.Regularity regularity)
        {
            FeatureRegularity FeatureRegularity = regularity as FeatureRegularity; 
            IList<Regularity> FieldRegularities = FeatureRegularity.FieldRegularityCollection;
            IDictionary<string, string> fieldDic = new Dictionary<string, string>();
            if (FieldRegularities != null)
            {
                foreach (Regularity fg in FieldRegularities)
                {
                    Cread.Model.Field fromField = fg.from as Cread.Model.Field;
                    Cread.Model.Field toField = fg.to as Cread.Model.Field;
                    string fName = fromField.FieldName;
                    string tName = toField.FieldName;
                    if (fName != tName)
                    {
                        fieldDic.Add(fName, tName);
                    }
                } 
            } 
            IQueryFilter queryFilter = new QueryFilterClass();
            queryFilter.WhereClause = FeatureRegularity.Fil