本文主要是介绍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);
这篇关于ArcGISEngine10.1访问ArcSDE【一】的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!