Connect to ArcSDE

来源:互联网 发布:网络生态圈 编辑:程序博客网 时间:2024/06/05 17:43

Refer to ".NET Help for VS2005" ,I get the code as follows:

        public IWorkspace OpenArcSDEWorkspace(string server, string instance, string user,
        
string password, string database, string version)
        
{
            ESRI.ArcGIS.esriSystem.IPropertySet propertySet 
= new ESRI.ArcGIS.esriSystem.PropertySetClass();
            propertySet.SetProperty(
"SERVER", server);
            propertySet.SetProperty(
"INSTANCE", instance);
            propertySet.SetProperty(
"DATABASE", database);
            propertySet.SetProperty(
"USER", user);
            propertySet.SetProperty(
"PASSWORD", password);
            propertySet.SetProperty(
"VERSION", version);

            IWorkspaceFactory workspaceFactory 
= new ESRI.ArcGIS.DataSourcesGDB.SdeWorkspaceFactoryClass();
            
return workspaceFactory.Open(propertySet, 0);
        }

 

also you can use the  ArcCatalog to test the connection,and i will use the ArcCatalog 9.2 as an example to illustrate.

first ,start up the ArcCatalog 9.2 as image 1 shows.

image 1

Double click the "Add Spatial Database Connection" then a dialog display on current page,configure the parameter as image 2 shows:

image 2

原创粉丝点击