1. 程式人生 > >【ArcEngine】AE連接SDE_For_SQLServer參數設置

【ArcEngine】AE連接SDE_For_SQLServer參數設置

version col 數據 pro pan pre property ces per

SDE for sqlserver直連的ArcEngine訪問

Ae中的數據的連接實質還是采用服務連接的方式。連接代碼如下:

 1  public IWorkspace Getworkspace()
 2   {
 3       IPropertySet propertySet = new PropertySetClass();
 4       propertySet.SetProperty("SERVER", "127.0.0.1");  
 5       propertySet.SetProperty("INSTANCE", "sde:sqlserver:127.0.0.1
"); 6 propertySet.SetProperty("DATABASE", "sde"); 7 propertySet.SetProperty("USER", "sa"); 8 propertySet.SetProperty("PASSWORD", "sa"); 9 propertySet.SetProperty("VERSION", "SDE.DEFAULT"); 10     Type factoryType = Type.GetTypeFromProgID("esriDataSourcesGDB.SdeWorkspaceFactory
"); 11 IWorkspaceFactory workspaceFactory = (IWorkspaceFactory)Activator.CreateInstance(factoryType); 12 return workspaceFactory.Open(propertySet, 0); 13 }

對於參數INSTANCE,

sde服務狀態 參數值
已經啟動 "5151" 或者 "sde",或者 “sde:sqlserver:127.0.0.1”
未啟動 “sde:sqlserver:127.0.0.1”

【ArcEngine】AE連接SDE_For_SQLServer參數設置