今天在使用IFeature 接口下的CreateFeature()方法创建要素时,报错如下图:
应该是许可或权限的问题,具体原因不明。但用下面的方法解决了问题,在此记录一下。
解决办法:在主程序main()函数中添加如下代码即可:
AoInitialize aoi = new AoInitializeClass();
esriLicenseProductCode productCode = esriLicenseProductCode.esriLicenseProductCodeEngineGeoDB;
if (aoi.IsProductCodeAvailable(productCode) == esriLicenseStatus.esriLicenseAvailable)
{
aoi.IsProductCodeAvailable(productCode);
if (aoi.Initialize(productCode) != ESRI.ArcGIS.esriSystem.esriLicenseStatus.esriLicenseCheckedOut)
DevExpress.XtraEditors.XtraMessageBox.Show(",请检查ArcEngine中的GDBEdit许可!");
}
else
{
DevExpress.XtraEditors.XtraMessageBox.Show(",请检查ArcEngine中的GDBEdit许可!");
}