GIS大奔

enjoyGIS

ArcGISEngine10.1访问ArcSDE【一】

直连式

            IWorkspace pWkspace = null;

            ESRI.ArcGIS.Geodatabase.IWorkspaceFactory2 workspaceFactory = null;

            ESRI.ArcGIS.esriSystem.IPropertySet pPropertySet = new ESRI.ArcGIS.esriSystem.PropertySetClass();

            pPropertySet.SetProperty("SERVER", "lingy");

            pPropertySet.SetProperty("INSTANCE", "sde:oracle11g:orcl");

            pPropertySet.SetProperty("AUTHENTICATION_MODE","DBMS");

            pPropertySet.SetProperty("USER", "sde");

            pPropertySet.SetProperty("PASSWORD", "sde");

            pPropertySet.SetProperty("VERSION", "SDE.DEFAULT");

            workspaceFactory =(ESRI.ArcGIS.Geodatabase.IWorkspaceFactory2)newESRI.ArcGIS.DataSourcesGDB.SdeWorkspaceFactoryClass();

            pWkspace =workspaceFactory.Open(pPropertySet, 0);

 

服务式

            IWorkspace pWkspace = null;

            ESRI.ArcGIS.Geodatabase.IWorkspaceFactory2 workspaceFactory = null;

            ESRI.ArcGIS.esriSystem.IPropertySet pPropertySet = new ESRI.ArcGIS.esriSystem.PropertySetClass();

            pPropertySet.SetProperty("SERVER", "lingy");

            pPropertySet.SetProperty("INSTANCE", "esri_sde");

            pPropertySet.SetProperty("DATABASE", "orcl");

            pPropertySet.SetProperty("USER", "sde");

            pPropertySet.SetProperty("PASSWORD", "sde");

            pPropertySet.SetProperty("VERSION", "SDE.DEFAULT");

            workspaceFactory =(ESRI.ArcGIS.Geodatabase.IWorkspaceFactory2)newESRI.ArcGIS.DataSourcesGDB.SdeWorkspaceFactoryClass();

            pWkspace =workspaceFactory.Open(pPropertySet, 0);

 

连接文件式

 

            IWorkspace pWkspace = null;

            ESRI.ArcGIS.Geodatabase.IWorkspaceFactory workspaceFactory = null;

            workspaceFactory =(ESRI.ArcGIS.Geodatabase.IWorkspaceFactory)newESRI.ArcGIS.DataSourcesGDB.SdeWorkspaceFactoryClass();

            pWkspace =workspaceFactory.OpenFromFile(@"C:\Users\Administrator\Documents\ArcGIS\Connection.sde", 0);

 

连接字符串式

            string connectionString = "SERVER=lingy;DATABASE=orcl;INSTANCE=5151;USER=sde;PASSWORD=sde;VERSION=sde.DEFAULT";

            //connectionString="INSTANCE=sde:oracle11g:orcl;USER=sde;PASSWORD=sde;VERSION=sde.DEFAULT";

            IWorkspace pWkspace = null;

            ESRI.ArcGIS.Geodatabase.IWorkspaceFactory2 workspaceFactory = null;

            workspaceFactory =(ESRI.ArcGIS.Geodatabase.IWorkspaceFactory2)newESRI.ArcGIS.DataSourcesGDB.SdeWorkspaceFactoryClass();

            pWkspace = workspaceFactory.OpenFromString(connectionString,0);

 

阅读更多
文章标签: ArcGIS c# esri
个人分类: 本地开发
上一篇C#+AE 展开/收缩图层的图例
下一篇ArcGISEngine实现图层输出kml
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭