using System;
using ESRI.ArcGIS.DataSourcesFile;
using ESRI.ArcGIS.esriSystem;
using ESRI.ArcGIS.Geodatabase;
namespace MyNamespace
{
class MyProgram
{
private static LicenseInitializer _licenseInitializer = new LicenseInitializer();
[STAThread()]
static void Main(string[] args)
{
_licenseInitializer.InitializeApplication(new esriLicenseProductCode[] { esriLicenseProductCode.esriLicenseProductCodeEngineGeoDB },
new esriLicenseExtensionCode[] { });
Type factoryType = Type.GetTypeFromProgID("esriDataSourcesGDB.SqlWorkspaceFactory");
IPropertySet propertySet = new PropertySetClass();
propertySet.SetProperty("SERVER", "servername");
propertySet.SetProperty("INSTANCE", "sde:sqlserver:servername");
propertySet.SetProperty("AUTHENTICATION_MODE", "DBMS");
// propertySet.SetProperty("AUTHENTICATION_MODE", "OSA");
propertySet.SetProperty("DATABASE", "test1");
propertySet.SetProperty("USER", "username");
propertySet.SetProperty("PASSWORD", "password");
propertySet.SetProperty("VERSION", "sde.DEFAULT");
IWorkspaceFactory workspaceFactory = new SDCWorkspaceFactory();
IWorkspace workspace = workspaceFactory.Open(propertySet, 0);
}
}
}
0 comments :
Post a Comment