using System.Runtime.InteropServices;

if (ex is COMException)
{
     int errorCode = (ex as COMException).ErrorCode;
}

根据得到的错误代码errorCode ,再到developer help for ArcGIS 帮助中搜索就可以等到Bug的错误描述,这是解决AE问题一种很不错的方法。

 

例如:

                try{

                IPropertySet pProSet = new PropertySetClass();
                pProSet.SetProperty("SERVER", "beniy");
                pProSet.SetProperty("INSTANCE", "5151");
                pProSet.SetProperty("USER", "sde");
                pProSet.SetProperty("PASSWORD", "arcsde");
                pProSet.SetProperty("VERSION", "SDE.DEFAULT");

               IWorkspaceFactory pSdeWorkSpFac = new SdeWorkspaceFactoryClass();

               pSdeWorkSpFac = pWorkSpFac.Open(pProSet, 0);  //抛出异常

               }

           catch (Exception ex)
            {
                if (ex is COMException)
                {
                    int errorCode = (ex as COMException).ErrorCode;
                }
            }

            此时,errorCode=-2147220952。

           到developer help for ArcGIS 帮助中用'-2147220952'进行搜索,得到错误描述:

FDO_E_LICENSE_NOT_INITIALIZED -2147220952 License not intialized

               得到思路是缺乏许可,对许可进行初始化即可。

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-08-05
  • 2021-11-03
  • 2021-08-19
  • 2022-12-23
  • 2022-01-21
猜你喜欢
  • 2021-10-10
  • 2022-01-19
  • 2021-11-06
  • 2021-10-13
  • 2021-07-05
  • 2021-08-07
  • 2021-08-17
相关资源
相似解决方案