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);
}
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