关闭

ArcGISEngine10.1访问ArcSDE【一】

标签: ArcGISc#esri
1603人阅读 评论(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", "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);

 

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:416154次
    • 积分:6984
    • 等级:
    • 排名:第3430名
    • 原创:292篇
    • 转载:3篇
    • 译文:1篇
    • 评论:36条
    最新评论